C# Contact Form on GoDaddy

Hi!  How are you? I’m fine, thanks for asking! 🙂

I haven’t posted any C# stuff in a while but I’m working on something that bears mentioning.  If you are sending C# emails via a contact form you’ll want to see this site:

http://support.godaddy.com/help/article/1073/using-cdosys-to-send-email-from-your-windows-hosting-account

And use this code:

// language -- C#
// import namespace
using System.Web.Mail;

private void SendEmail()
{
   const string SERVER = "relay-hosting.secureserver.net";
   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;
   SmtpMail.Send(oMail); 
   oMail = null;	// free up resources
}