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.”
4 comments:
Very nicely done. This was very helpful. I was trying to find this solution while I was on hold with Godaddy. I told the agent about it and it was new news to him. Once again, very helpful, THANK YOU!
Thank you so much! I have been searching for a solution all week, and wanted to throw in the towel, then stumbled upon your posting. Thank you!
-Joseph Marinaccio
Marinaccio Family Design
Can anyone recommend the best IT automation system for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central network health tool
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!
Thank You
Post a Comment