Using CDOSYS to Send Email with GoDaddy

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 GoDaddy IIS 6 and IIS 7 Windows hosting accounts. The following code sample demonstrates how to create, format, and send email with GoDaddy.

The server “relay-hosting.secureserver.net” is used to send email from your GoDaddy hosted domain. You must populate the SmtpMail object’s SmtpServer property with this value. GoDaddy’s hosting servers allow for email attachments up to 30 MB.


// 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

}

GoDaddy SQL Server Database Setup – Connection String

Before you upload your ASP.NET 3.5 application onto your GoDaddy hosting server, you need to modify the connection strings section of your web.config file.

<connectionStrings>

<add name=”Personal” connectionString=” Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False” providerName=”System.Data.SqlClient” /> <remove name=”LocalSqlServer”/> <add name=”LocalSqlServer” connectionString=” Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False” providerName=”System.Data.SqlClient” />

</connectionStrings>

NOTE: You may want to back up the web.config file on your local computer or simply comment out your current connection strings before you make any changes. This way, you can easily return to developing your application on you local computer.

This is an example of the connection strings section that will connect an ASP.NET 3.5 application to one of the GoDaddy SQL Servers:
NOTE: You can find your server name, database name, user ID, and password in the SQL Server section of your GoDaddy Hosting Control Center. These connection string values map to host name, database name, user name, and password, respectively. The user name and password values are those specified during SQL database (not hosting account) creation.

Recommended Web Hosts for Starter Kits

I am only going to speak from personal experience here but the two best hosts for asp.net that I have used are discountasp.net and ultimahosts.net.  I currently have all of my sites over at ultimahosts.net because they were a better value for me.  As an additional bonus ultimahosts.net will instantly set you up with a free trial account so you can make sure they work for you before you commit to a hosting plan. While quite inexpensive, I had nothing but problems with 1and1.com and godaddy.com and the price discount was not worth the headache.  That being said if anyone has had good success with either one of those hosts or any other host for that matter please chime in with your thoughts.�