Here is the C# version of the GoDaddy.com ASP.NET 2.0 Send Mail by Moojjoo http://www.mmwebs.com
Web.Config
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/> <!-- Be sure to change this to false when going to production -->
</system.web>
<system.net>
<mailSettings>
<smtp>
<network
host="relay-hosting.secureserver.net" />
</smtp>
</mailSettings>
</system.net>
</configuration>
.cs code behind for your .aspx page
protected void btnSubmit_Click(object sender, EventArgs e)
{
MailMessage myMail = new MailMessage();
myMail.From = new MailAddress("from@yourdomain.com");
myMail.Subject = "Contact Form";
MailAddressCollection myMailTo = new MailAddressCollection();
myMail.To.Add("to@domain.com");
StringBuilder sb = new StringBuilder();
sb.Append("Last Name: " + txtFirstName.Text + "<br>");
sb.Append("First Name: " + txtFirstName.Text + "<br>");
sb.Append("Address: " + txtAddress.Text + "<br>");
sb.Append("City: " + txtCity.Text + "<br>");
sb.Append("State: " + ddlState.SelectedValue + "<br>");
sb.Append("Zip: " + txtZip.Text + "<br>");
sb.Append("Email: " + txtEmail.Text + "<br>");
sb.Append("Questions/Comments: " + txtQandC.Text + "<br>");string strBody = sb.ToString();
myMail.Body = strBody;
myMail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Credentials = CredentialCache.DefaultNetworkCredentials;
try
{
smtp.Send(myMail);
myMail = null;
}
catch (System.Exception ex)
{
Response.Write(ex.Message);
}
}
Moojjoo Õ¿Õ
http://www.mmwebs.com
http://www.autoinventoryonline.com/