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.
The server "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 server objects are supported on Windows shared hosting servers?
What ASP.NET runtime version should I choose?
What is ASP.NET AJAX?
Is Parent Path Enabled on Shared ASP Hosting?
Creating an ASP.NET 2.0 Personal Web Site
Will My ASP.NET 1.1 Value Applications Function if I Enable the ASP.NET 2.0 Runtime?
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?