views:

157

answers:

3

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  A: 

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.

ho1
I know that the mismatched domain / sender issue is an automatic flag in most filters. I'd start with this.
etc
Oh that may be it. The site is currently in our dev domain, but all users who have emails are in Production. I'll see if I can test this.
jamone
+4  A: 

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.

Zachary
it was the cross domain sending.
jamone
A: 

Hi ,

I am having a similar problem . I am able to send an email successfully to my gmail account and the mail goes to the INBOX but when i send it to hotmail it reaches the Junk/Spam folder . ? I am using System.Net.Mail to send email.

Regards, Francis P.

Francis