AllExperts > Experts 
Search      
C#
Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More C# Answers
Question Library

Ask a question about C#
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Nick
Expertise
I can answer questions regarding C#, C , SQL, Visual Basic, .Net Framework 2.0, general programming technique, and general algorithm development. My current area of focus is C#.

Experience
C /VB programmer since 10th grade. I used to love video game development (still do, just don't do it anymore). Have real world experience in 3 companies for a total of about 2 years non-academic experience.

Organizations
Keneisys (a security software company)

Education/Credentials
BS in Computer Science with minor in Entertainment Technology.

Awards and Honors
"The Next Bill Gates" gag award :-). College: Summa Cum Laude.

 
   

You are here:  Experts > Computing/Technology > C/C++ > C# > all mails land up in spam

Topic: C#



Expert: Nick
Date: 4/28/2008
Subject: all mails land up in spam

Question
Hello,

Whenever i send any email from C#.net, all of them land up in spam
eg

SmtpClient smtpmail=new SmtpClient();
               smtpmail.Host="localhost";
               MailMessage mymess1 = new MailMessage();
               //                mymess1.To.Add(new MailAddress("cmrhemalatha@NOSPAM.gmail.com"));//bitmask [at] [nospam].fred.net
               mymess1.To.Add(new MailAddress("abc@gmail.com"));
               mymess1.From = new MailAddress("checkmail@abc.in");
               mymess1.Subject = "check";
               mymess1.Body = "no spam";
               smtpmail.Send(mymess1);
               Response.Write("send");


When i check into my email, it will be always in spam folder.
Is there any way to avoid it.

Regards
Hema

Answer
Hi Hema,

Not sure why that is happening. My guess is this has more to do with your email client rather than your C# code. You might try using all valid email addresses (ie, in the "to" and "from" of the email). On the client side, there could be any number of things flagging the email as spam. Once you get one of the emails in your spam folder, mark it as "not spam" if your email client offers that option. Also, add the "from" address of your email to your client's safe senders list (ie, the list it recognizes as valid email addresses). You might also try filling in more realistic data into your email (ie, put "how are you doing" into your message body instead of "no spam"). Basically, make the email look like a real email so your client doesn't think it's not. I also find it a bit suspect that "smtpmail.Host" is set to "localhost". Perhaps your client doesn't recognize this host (ie, your computer) and is flagging the email as spam. I'm not sure if you are supposed to set it to something other than "localhost", but it was the only thing that really jumped out at me. Let me know if you are able to figure this one out.

Good Luck,
   Nick

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.