.NET System.Net.Mail的消息一直被标记垃圾,内部服务器上标记、器上、垃圾、消息

2023-09-04 01:10:21 作者:残傷ゞ

我使用System.Net.Mail来发送几封电子邮件。这些电子邮件被发送我们的内部邮件服务器的本地地址。但是,所有的消息都是直行至垃圾在Outlook中。这些消息正在从有效的电子邮件地址发送的。什么是导致我们我们的服务器将其标记为垃圾邮件?

  MailMessage味精=新MailMessage();
msg.IsBodyHtml =真;
msg.Subject =主体;
msg.Body =身体;
msg.From =新MailAddress(从);
msg.To.Add(到);
SmtpClient客户端=新SmtpClient(服务器,25);
client.Send(MSG);
 

解决方案

我已经看到这种情况发生了很多,当发送邮件的SMTP直接发送与转发了你的官方(集DNS)邮件服务器。正常的规则导致这是您的SMTP发送IP不匹配IP您的域名SMTP地址。

例如:

您域的邮件发送服务器smtp.domain.com = 10.1.1.1

System.Net.Mail使用服务器上运行的code的IP地址= 10.1.1.100

由于它们不匹配,它就会被标记为垃圾邮件。如果你可以中继关闭您的邮件服务器,这可能会解决你的问题。如果你不能,你可以使用组策略来设置Outlook中的规则说从你的域的所有电子邮件是安全的。只有乐于助人,当机器在网络上,外部用户仍然可以看到它得到标记为垃圾邮件。

VB.NET 教程 04 高级教程

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.