开发者

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

开发者 https://www.devze.com 2023-01-01 13:18 出处:网络
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 me

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)开发者_运维知识库;


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消