using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net; using System.Net.Mail; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class ContactUs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnsend_Click(object sender, EventArgs e) { if (txtcontactphone.Text.Trim() != "" && txtcontactName.Text.Trim() != "" && contactMessage.Text.Trim() != "") { // string result = apicall("http://146.88.26.101/index.php/smsapi/httpapi/?uname=softhunter123&password=123456&sender=richoi&receiver=" + reschk.FirstOrDefault().Mobile + "&route=TA&msgtype=1&sms=" + msg); string from = ConfigurationManager.AppSettings["FROMEMAIL"].ToString(); MailMessage m = new MailMessage(); m.Subject = "Punjab Fortune Website Contact Enquiry : "; m.Body = "Name :" + txtcontactName.Text + " Email : " + txtcontactEmail.Text + " Phone : " + txtcontactphone.Text + " Message :" + contactMessage.Text; // m.IsBodyHtml = true; m.From = new MailAddress(from); m.To.Add(new MailAddress(from)); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["SMTP"].ToString(); NetworkCredential authinfo = new NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]); smtp.EnableSsl = false; smtp.UseDefaultCredentials = false; smtp.Credentials = authinfo; smtp.Send(m); txtcontactphone.Text = ""; txtcontactName.Text = ""; txtcontactEmail.Text = ""; contactMessage.Text = ""; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MSG", "alert('Sent Successfully');", true); } } }