Emails sent by C# code ending up in junk mail

USING windows 2003 SBS and in C#

i am using this code to send email to different users "within" the Co. using the code below, the problem is almost all the time the emails are ending up in users JUNK mail !!! some even changed in Outlook and mark as not junk but again it marks it in junk, is there anyway i can mark this in server to be NOT junk? so regardless of what user does it ends up in their inbox?


MailMessage mail2 = new MailMessage();
                mail2.To = (Email_From);
                mail2.From = ("");
                mail2.Subject = "your comments has been Published!";
                mail2.Body = "To view the comment click here: http://co/marketing/m2Display.aspx?ID=" + comID;
                SmtpMail.SmtpServer = "";

Open in new window

Who is Participating?
Kumaraswamy RCommented:

My suggestion :
   use the Namespace , this is feacture of 2.0
   this is the System.Web.mail Namespace is 1.1

More Info
note that when adding the html to the mail he uses this method
System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(BodyText, null, text/html);

Open in new window

some quick info based on my own experience and dealing with ISPs:
-make sure your mailfrom is actually a valid address
-include a text version to your html email
-avoid strong punctuation in your subjects ("!!!" is a good wayt to the spam box)

run a spam assassin test on your generated emails to make sure there's nothing you overlooked (you can use this tool for instance):
While I was dealing with my code, I had used a similar line as follows:
objEmail.Priority = MailPriority.High;

and I don't have any problem but e.g. I had hesitated using strong punc. as lenordiste advices.
and thanks for the link, gemailj. I really love EE:D

Best regards.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.