In my ASP.NET MVC project on .NET 4.5.2, I’m sending emails. During this process, emails with “gmail” domain end up in spam. However, all other emails are delivered correctly. What could be the reason for only emails with “gmail” domain ending up in spam? Could it be a problem in development or is it solely due to the mail server?
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
MailMessage email = new MailMessage("Email", message.Destination);
email.Subject = message.Subject;
email.Body = message.Body;
email.IsBodyHtml = true;
var mailClient = new SmtpClient("smtp.office365.com", 587)
{
Credentials = new NetworkCredential("Email", "password"),
EnableSsl = true
};
await mailClient.SendMailAsync(email);