Friday, July 13, 2012

Sending Email from GoDaddy Windows Shared Hosting using 3.5


The server "" is used to send email from your hosted domain on servers. You must populate the SmtpMail object's SmtpServer property with this value.


// import namespace
using System.Web.Mail;
private void SendEmail()
   const string SERVER = "";
   MailMessage oMail = new System.Web.Mail.MailMessage();
   oMail.From = "emailaddress@domainname";
   oMail.To = "emailaddress@domainname";
   oMail.Subject = "Test email subject";
   oMail.BodyFormat = MailFormat.Html; // enumeration
   oMail.Priority = MailPriority.High; // enumeration
   oMail.Body = "Sent at: " + DateTime.Now;
   SmtpMail.SmtpServer = SERVER;
   oMail = null; // free up resources

Note: GoDaddy servers will not send email containing a “From:” header entry of gmail, yahoo, hotmail, live, aim, aol or msn.

Happy Coding…

1 comment:

  1. Bluehost is ultimately the best hosting company with plans for all of your hosting needs.