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/
This blog shares my journey as a software engineer, along with personal reviews and life experiences I’ve gained along the way. “I have not failed. I've just found 10,000 ways that won't work.” — Thomas Edison. If you enjoy my content, please support it by clicking on ads (free for you, big help for me!) or by buying me a coffee on Ko-fi. Thank you!
Subscribe to:
Post Comments (Atom)
How to Install Linux on Legacy BIOS Systems
How to Install Linux on Legacy BIOS Systems Understanding Legacy BIOS Systems What is Legacy BIOS? Legacy BIOS, short for Basic Inp...
-
How to clear SharePoint People Picker suggestion cache If you have been SharePoint Site owner long enough, you would have definitely ...
-
Getting the following error (Figure 1): Server Error in '/' Application. ID4014: A SecurityTokenHandler is not registered to ...
-
The problem was that the remote connection needed to utilize Named Pipes, but in order to utilize Named Pipes both the machine hosting the i...
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