using System; public partial class ContactUs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { string toEmail = "support@fantasyfootballdraftcenter.com"; //string toEmail = "ratneshs@ultraglobal.biz"; //string emailSubject = "Contact Us: " + ddlMessageType.SelectedItem.Text; string emailSubject = "CONTACT"; string emailName = txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim(); emailName = emailName.Trim(); string fromEmail = txtEmail.Text.Trim(); string filePath = Server.MapPath("ContactUsMail.htm"); if (System.IO.File.Exists(filePath)) { System.IO.StreamReader sr = new System.IO.StreamReader(filePath); System.Text.StringBuilder sbMailContent = new System.Text.StringBuilder(sr.ReadToEnd()); sr.Close(); sbMailContent.Replace("_FirstName", txtFirstName.Text.Trim()); sbMailContent.Replace("_LastName", txtLastName.Text.Trim()); sbMailContent.Replace("_Phone", System.Text.RegularExpressions.Regex.Replace(txtPhone.Text.Trim(), @"\D", "")); sbMailContent.Replace("_Email", txtEmail.Text); sbMailContent.Replace("_TypeMessage", ddlMessageType.SelectedItem.Text); sbMailContent.Replace("_Comments", txtComment.Text); string emailMsg = ""; //string strEmailPassword = UG.Configuration.Instance().AdminEmailPassword.Trim(); //emailMsg = UG.Utility.Mail.Send(emailName, fromEmail, toEmail, emailSubject, sbMailContent.ToString(), "", strEmailPassword); emailMsg = UG.Utility.Mail.Send(emailName, fromEmail, toEmail, emailSubject, sbMailContent.ToString(), "", ""); if (emailMsg == "success") { ErrLabel.Text = "We have received your details. We will contact you soon."; Response.AddHeader("Refresh", "3;url=ContactUS.aspx"); } else { ErrLabel.Text = "Due to some technical problem sending email was unsuccessfull. Please try again."; } } } } }