首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么Sendgrid在我的asp core 2.1应用程序中没有发送任何确认电子邮件?

问为什么Sendgrid在我的asp core 2.1应用程序中没有发送任何确认电子邮件?
EN

Stack Overflow用户
提问于 2019-01-30 10:37:56
回答 1查看 694关注 0票数 0

我在微软文档(核心2.1)中开始了“ASP.NET核心中的帐户确认和密码恢复”主题,并编写了整个应用程序。但当我运行这个应用程序时,我没有收到任何电子邮件。我在Sendgrid中创建了一个帐户,并在那里设置了密钥值。此外,我调试了应用程序并查看了值,所有的值都是正确的。甚至新用户的用户名和密码都用EmailConfirmation=false保存在数据库中;我一步一步地遵循了所有的说明,以及所有调试电子邮件的建议。但在我的收件箱(垃圾邮件和其他文件夹)中看不到任何确认电子邮件。你有什么建议可以让我找到我的问题吗?

以下是该主题的链接地址:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.1

然后我写了下面的控制台应用程序,但仍然没有...

代码语言:javascript
复制
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();
        }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2019-01-31 12:10:41

我询问了Sendgrid,我被告知我不能使用我的yahoo电子邮件(或gmail,...)作为发件人电子邮件;这是答案的一部分:"Yahoo遵守称为DMARC的电子邮件安全标准。DMARC指示电子邮件提供商拒绝发件人域名为Yahoo域名,但邮件源自未经批准的域服务器/服务的邮件。“所以我需要使用我自己的邮件域名;

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54432625

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档