22 September 2008

Send Spam-free Email using ASP.NET

Sorry, the previous blog contains a class which has been deprecated. Please use the namespace System.Net.Mail instead of System.Web.Mail;

Moreover, mails sent in previous way were being marked as spam in GMail. Use a real mail server to reduce the probability of being spam. Here Google mail server has been used along with GMail account and password.

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";

MailMessage mail = new MailMessage("from@mail.com", "to@mail.com", "Subject", "Body");
smtp.Credentials = new System.Net.NetworkCredential("user@gmail.com", "password");
smtp.EnableSsl = true;
smtp.Send(mail);

Note:

  1. ‘from’ address will not work, rather "user@gmail.com" will be the sender.
  2. It is not assured that mail will not be marked as spam.

0 Comments:

 

© 2007 t!ps n tr!cks: Send Spam-free Email using ASP.NET



Template unik dari rohman


---[[ Skip to top ]]---