I use the latest SendGrid.NET package (8.0.3) to send email from my ASP.NET Core web application:
public Task SendEmailAsync(string email, string subject, string message) { return Send(email, subject, message); } async Task Send(string email, string subject, string message) { dynamic sg = new SendGridAPIClient(_apiKey); var from = new Email(" noreply@my.domain ", "My Name"); var to = new Email(email); var content = new Content("text/html", message); var mail = new Mail(from, subject, to, content); await sg.client.mail.send.post(requestBody: mail.Get()); }
It works locally, but runs on an Azure application service instance, mail fails.
The code works fine without any exceptions, so I donβt need much to work, but I think it might be some kind of problem with the firewall.
Has anyone encountered similar problems? How can I do it?
source share