Open marcoaureliok opened 4 years ago
@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 "info@company.com".
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