.NET System.Net.Mail messages are always being flagged junk, on internal server

独自空忆成欢 提交于 2020-01-21 14:35:10

问题


I'm using System.Net.Mail to send out a few emails. The emails are being sent by our internal mail server to local addresses. However all of the messages are going straight to junk in Outlook. The messages are being sent from valid email addresses. What would be causing our our servers to label it as junk?

MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;
msg.Subject = subject;
msg.Body = body;
msg.From = new MailAddress(from);
msg.To.Add(to);
SmtpClient client = new SmtpClient(server, 25);
client.Send(msg);

回答1:


I've seen this happen a lot when the outgoing SMTP is sending directly versus relaying off your official (set in DNS) mail server. The normal rule causing this is that your SMTP sending IP does not match the IP of your domains SMTP address.

Example:

Your domain's outgoing mail server smtp.domain.com = 10.1.1.1

System.Net.Mail uses IP address of the server running the code = 10.1.1.100

Since they don't match, it gets flagged as SPAM. If you can relay off your mail server, this will probably solve you problem. If you can't, you can use Group Policy to set a rule in Outlook saying all email from your domain is SAFE. Only helpful when the machines are on your network, external users will still see it get marked as SPAM.




回答2:


This depends on the settings on your email server/clients. Various things will make them give a higher "spam score". For example, the fact that it's HTML usually raises the spam score, and I think also if the from address doesn't match the domain it was sent from etc.



来源:https://stackoverflow.com/questions/2907644/net-system-net-mail-messages-are-always-being-flagged-junk-on-internal-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!