簡體   English   中英

為什么Sendgrid在asp core 2.1的應用程序中不發送任何確認電子郵件?

[英]why Sendgrid does not send any confirmation email in my app in asp core 2.1?

我在Microsoft文檔(Core 2.1)中啟動了“ ASP.NET Core中的帳戶確認和密碼恢復”主題,並編寫了整個應用程序。 但是,當我運行該應用程序時,我沒有收到任何電子郵件。 我在Sendgrid中建立了一個帳戶,並在那里設置了密鑰值。 另外,我調試了該應用程序並觀察了值,所有結果都是正確的。 甚至新用戶的用戶名和密碼也都以EmailConfirmation = false的形式保存在數據庫中; 我逐步遵循了所有說明以及所有調試電子郵件建議。 但是我在收件箱(以及垃圾郵件和其他文件夾)中看不到任何確認電子郵件。 您對我如何找到問題有任何建議嗎?

這是主題的鏈接地址: https : //docs.microsoft.com/zh-cn/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();
        }
    }
}

我問了Sendgrid,並被告知我不能使用我的yahoo電子郵件(或gmail,...)作為發件人電子郵件; 這是答案的一部分:“ Yahoo遵守稱為DMARC的電子郵件安全標准。DMARC指示電子郵件提供商拒絕“發件人”域為Yahoo域但郵件來自未經批准的域服務器/服務的郵件。” 因此,我需要使用自己的郵件域;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM