C# 无法在ASP.NET Core 3.1 MVC中发送确认电子邮件

C# 无法在ASP.NET Core 3.1 MVC中发送确认电子邮件,c#,asp.net-core,asp.net-core-mvc,asp.net-core-3.1,C#,Asp.net Core,Asp.net Core Mvc,Asp.net Core 3.1,在startup.cs中,我有: services.AddTransient<IEmailSender, EmailSender>(); services.Configure<AuthMessageSenderOptions>(Configuration); 我得到的是这个页面,而不是发送邮件。根据Microsoft文档,我没有/Identity/Account/Manage/PersonalData页面。以前没有使用过SendGrid,但根据URL,我认为您需要

在startup.cs中,我有:

 services.AddTransient<IEmailSender, EmailSender>();
 services.Configure<AuthMessageSenderOptions>(Configuration);


我得到的是这个页面,而不是发送邮件。根据Microsoft文档,我没有/Identity/Account/Manage/PersonalData页面。

以前没有使用过SendGrid,但根据URL,我认为您需要完成帐户的用户注册poudyalrupak2@gmail.com在能够发送电子邮件之前:

另外,作为对代码的一个小改进,您应该使任何调用异步方法的方法async

public async Task Execute( string subject, string message, string email)
,然后在任何异步调用上等待:

return await client.SendEmailAsync(msg);

以前没有使用过SendGrid,但根据URL,我认为您需要完成帐户的用户注册poudyalrupak2@gmail.com在能够发送电子邮件之前:

另外,作为对代码的一个小改进,您应该使任何调用异步方法的方法async

public async Task Execute( string subject, string message, string email)
,然后在任何异步调用上等待:

return await client.SendEmailAsync(msg);

PersonalData页丢失,因为默认情况下,除非您告诉它,否则它不会退出。复制和粘贴似乎是问题的一部分,因为您有基于示例的默认信息,而不是使用sendgrid的实际帐户。缺少PersonalData页,因为除非您告诉它,否则默认情况下它不会退出。复制和粘贴似乎是问题的一部分,因为您有基于示例的默认信息,而不是使用sendgrid的实际帐户。