Reputation: 17
I started the "Account confirmation and password recovery in ASP.NET Core" topic in the Microsoft documents (Core 2.1), and wrote the entire application. But when I run the app, I don't receive any email. I made an account in the Sendgrid and set the key value there. Also, I debugged the app and watched the values, and all were correct. Even the username and password of the new user is saved in database with EmailConfirmation=false; I followed all instructions step by step, and all the debug email suggestions. But I can't see any confirmation email in my inbox (and spam, and other folders). Do you have any suggestion on how I can find my problem?
Here is the link address of the topic: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.1
then I wrote the following console app, but still nothing...
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();
}
}
}
Upvotes: 0
Views: 765
Reputation: 17
I asked Sendgrid, and I was told that I cannot use my yahoo email (or gmail,...) as the sender email; this is part of the answer: "Yahoo observes an email security standard called DMARC. DMARC instructs email providers to reject messages where the From domain is a Yahoo domain, but the message originates from a non-approved domain server/service." So I need to use my own mail domain;
Upvotes: 1