views:

390

answers:

3

I am sending email throught SMTP Client using below code.

MailMessage objMail = new MailMessage("FromEmail", "ToEmail", "Subject", "Email Body");
SmtpClient SmtpClnt = new SmtpClient();
SmtpClnt.Send(objMail);

I have two question here

  1. How can I ensure that email is not sent junk email folder?
  2. Can I hide from email to recipient and just show some textual name?

Thanks

+3  A: 

You can't do #1. The choice of whether a piece of email is marked as junk is up to the user. For example, they may create a rule that all mail from you (or with your name in it) is sent to their Junk mail folder (or deleted!). The best way to get folks to read your emails and not have automated systems treat it as spam is to send content that people want to read.

popester
+1  A: 
  1. You can't ensure it doesn't go into the junk folder. Different ISPs and mail clients have their own proprietary algorithms for classifying mail as junk. There's no way to guarantee delivery. If you set up a feedback loop with the ISP and/or get on a whitelist, that will help. SPF and DKIM also help. But there's no guarantee. A service such as Return Path can test whether your emails end up in the inbox or the junk folder, but these services are expensive. Your best option is to just send some test emails and see where they end up. Your IP address's reputation has a big impact... you want to make sure there is no spammy email coming from the same IP.

  2. No, you can't hide the from address. It is a standard part of the email message, and there's no way to tell email clients not to display it. If you want, you can make up a fake "from" address such as [email protected]. It doesn't have to be a real address if you don't need to receive replies to the email.

As Eric mentioned, it would be good to know why you want to do this... I hope you aren't trying to send spam. If you're sending large mailings to people who have opted in, you may want to use a third-party service rather than writing your own code. Handling unsubscribes and bounces is a big task.

As popester mentioned, the most important thing is to send relevant content to people who want to receive it...

Richard Beier
A: 

As others have already said, 2. is not an option and makes one wonder what you're up to!

Based on my experience the best results in avoiding emails being classified as spam come from sending the email through an SMTP server that requires authentication.

I was building an automated reply to a registration at a site, and Gmail, Yahoo etc were fine with the mails. However, they were always classified as spam by Hotmail. I played with the headers, from-address, reply-to address etc, but nothing helped, until I moved from PHP's own mail() function to an SMTP library and sent the mails via our domain registrar's SMTP server using valid credentials. Since then, no problems what so ever.

Lauri Lehtinen