Using CDOSYS to Send Email from Your Windows Hosting Account
CDOSYS is part of the System.Web.Mail namespace and is installed by default on Windows 2000 and Windows XP platforms. It replaces CDONTS for sending SMTP email messages and can be used with our IIS 6 and IIS 7 Windows hosting accounts. The following code sample demonstrates how to create, format, and send email.
relay-hosting.secureserver.net is used to send email from your hosted domain. You must populate the SmtpMail object's SmtpServer property with this value. Our shared hosting servers allow for email attachments up to 30 MB.
// import namespace
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;
oMail = null; // free up resources
For more information about CDOSYS, see MSDN.
Our mail server will not send email containing a "From:" header entry of aol, gmail, yahoo, hotmail, live, aim, or msn.
What ASP.NET runtime version should I choose?
Is Parent Path Enabled on Shared ASP Hosting?
What is ASP.NET 3.5?
What should I use to develop ASP.NET 3.5 Web sites?
Why are ASP.NET runtimes 2.0, 3.0 and 3.5 grouped together?
Using ASP.NET Cryptography Services with Your Web Site
Your message was successfully sent.
There was an error in sending your message, please try again.
Have a question about the content of this article?