using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
public partial class Enquiry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string str = null;
str ="
Email-ID: | " + txtEmailId.Text + " |
Your Name: | " + txtname.Text + " |
Address: | " + txtaddress.Text + " |
City: | " + txtcity.Text + " |
State: | "+ txtstate.Text + " |
Country: | " + txtcountry.Text + " |
ZIPCode: | " + txtzipcode.Text + " |
Phone No: | " + txtTelephoneNo.Text + " |
Mobile No: | " + txtMobileNo.Text + " |
Your Query: | " + txtYourQuery.Text + " |
Your Comments: | " + txtComments.Text +" |
";
Response.Write(SendMail("meetuchoudhary@gmail.com", "tatiwalaje@yahoo.com", "meetudmeet@yahoo.com", "Feedback from site", str));
Response.Redirect("query_submitted.aspx");
}
public string SendMail(string toList, string from, string ccList, string subject, string body)
{
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
string msg = string.Empty;
try
{
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add(toList);
if (ccList != null && ccList != string.Empty)
message.CC.Add(ccList);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
// smtpClient.Host = emailServerInfo.MailServerIP;
smtpClient.Host = "mail.tatiwalaje.com";
//smtpClient.Port = Convert.ToInt32(emailServerInfo.MailServerPortNumber);
smtpClient.Port = 25;
smtpClient.UseDefaultCredentials = true;
//smtpClient.Credentials = new System.Net.NetworkCredential(emailServerInfo.MailServerUserName, emailServerInfo.MailServerPassword);
smtpClient.Credentials = new System.Net.NetworkCredential("info@tatiwalaje.com", "extraction9c!");
smtpClient.Send(message);
msg = "Successful";
}
catch (Exception ex)
{
msg = ex.Message;
}
return msg;
}
protected void btnReset_Click(object sender, EventArgs e)
{
Response.Redirect("Enquiry.aspx");
}
}