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/
Robert Dannelly blog, Over the internet you can find me by "robert dannelly blog". The blog is an ongoing blog of my software engineering over technologies C#, VB.NET, Java, React, JavaScript, .NET Core Current, SQL Server 7 - Current Version, GIT, GitHub, Jira, Azure, AWS and HTML5. “I have not failed. I've just found 10,000 ways that won't work.” Thomas A. Edison, please click on all links to help support this blog. Thank you. “As an Amazon Associate, I earn from qualifying purchases.”