aspnet-core-3-signup-verification-api icon indicating copy to clipboard operation
aspnet-core-3-signup-verification-api copied to clipboard

Mailkit sender is not reaching Gmail

Open marcoaureliok opened this issue 4 years ago • 1 comments

aspnet-core-3-signup-verification-api/Services/EmailService.cs line 28

The following is not reaching Gmail:

email.Sender = MailboxAddress.Parse(from ?? _appSettings.EmailFrom);

changed to:

email.From.Add(MailboxAddress.Parse(from ?? _appSettings.EmailFrom));

and worked

marcoaureliok avatar Jul 23 '20 13:07 marcoaureliok

@marcoaureliok your solution is correct. Full error message from inbox I tried to send emails: "Messages missing a valid address in From: 550 5.7.1 header, or having no From: header, are not accepted."

However, you can just add it as new line of code. email.From.Add(new MailboxAddress(_appSettings.DisplayedSender, from ?? _appSettings.EmailFrom)); The _appSettings.DisplayedSender is a my solution for extracting the displayed sender. It just looks better. You can have a personalized sender e.g "Best company" instead of "[email protected]".

jurczewski avatar Aug 28 '20 10:08 jurczewski