I am using Azure Sendgrid to send emails from my ASP.net core web application. Intermittently, emails are not being received by some of the recipients. Some recipients receive the email, others do not.
Code below is for brevity, not including setting up MailMessage (FROM, TO, etc...)
I am using "smtp.sendgrid.net" as smtpserver with "port" 587 as smtpport.
string smtpServer = ConfigurationManager.AppSettings["MailSMTPServer"];
int smtpPort = int.Parse(ConfigurationManager.AppSettings["MailPort"]);
string username = ConfigurationManager.AppSettings["MailUserName"];
string pwd = ConfigurationManager.AppSettings["MailPassword"];
SmtpClient client = new SmtpClient(smtpServer);
client.Port = smtpPort;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(username, pwd);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailMessage);
I have talked with the IT dept where emails are not being received to see if they are being blocked. There is no record of the emails hitting their server.