我尝试使用 SmtpClient.Send() 从 c# 发送电子邮件,但它总是进入垃圾箱。如果我从 Outlook 发送它,它工作正常。有没有办法解决这个问题?有人告诉我修改电子邮件标题,但我不知道怎么做。提前致谢。这是我的代码
SmtpClient client = new SmtpClient();
client.Host = "smtp.server.com";
client.Credentials = new System.Net.NetworkCredential("user", "password");
MailAddress mailFrom = new MailAddress("mymail@server.com");
MailAddress mailTo = new MailAddress("yourmail@server.com");
MailAddress mailReply = new MailAddress("mymail@server.com");
MailMessage message = new MailMessage(mailFrom, mailTo);
message.Body = "This is a test message.";
message.Subject = "test message";
message.SubjectEncoding = System.Text.Encoding.UTF8;
message.BodyEncoding = System.Text.Encoding.UTF8;
client.Send(message);