我在微软文档(核心2.1)中开始了“ASP.NET核心中的帐户确认和密码恢复”主题,并编写了整个应用程序。但当我运行这个应用程序时,我没有收到任何电子邮件。我在Sendgrid中创建了一个帐户,并在那里设置了密钥值。此外,我调试了应用程序并查看了值,所有的值都是正确的。甚至新用户的用户名和密码都用EmailConfirmation=false保存在数据库中;我一步一步地遵循了所有的说明,以及所有调试电子邮件的建议。但在我的收件箱(垃圾邮件和其他文件夹)中看不到任何确认电子邮件。你有什么建议可以让我找到我的问题吗?
以下是该主题的链接地址:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.1
然后我写了下面的控制台应用程序,但仍然没有...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Mail;
using SendGrid;
using SendGrid.Helpers.Mail;
namespace ConsoleApp1
{
internal class Example
{
private static void Main()
{
Execute().Wait();
Console.Read();
}
static async Task Execute()
{
var client = new SendGridClient("my API Key I copied from sendgrid");
var from = new EmailAddress("my yahoo email which is my email used in sendgrid account", "my yahoo");
var subject = "Sending with SendGrid is Fun";
var to = new EmailAddress("my gmail ", "my gmail");
var plainTextContent = "and easy to do anywhere, even with C#";
var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
var response = await client.SendEmailAsync(msg);
//Console.Read();
}
}
}发布于 2019-01-31 12:10:41
我询问了Sendgrid,我被告知我不能使用我的yahoo电子邮件(或gmail,...)作为发件人电子邮件;这是答案的一部分:"Yahoo遵守称为DMARC的电子邮件安全标准。DMARC指示电子邮件提供商拒绝发件人域名为Yahoo域名,但邮件源自未经批准的域服务器/服务的邮件。“所以我需要使用我自己的邮件域名;
https://stackoverflow.com/questions/54432625
复制相似问题