mail

May 25 2010 10:13 AM

protected
void MailSend()
{
ar = (
ArrayList)Session["Detail"];
//ar = (string[])Session["User_Info"];
string To_email = ar[4].ToString().Trim();
MailMessage Mail = new MailMessage();
MailAddress ma = new MailAddress(ConfigurationManager.AppSettings["AdminId"], ConfigurationManager.AppSettings["Name"]);

Mail.From = ma;
Mail.To.Add(To_email);
Mail.IsBodyHtml =
true;
Mail.Subject =
"Subject";
//string bdy = "Dear " +ar[1].ToString()+ "<br>" + "Thanks for registration on Universal Export mart your password is " +ar[5].ToString() + " " + "we will give you a confirmation mail after that you can sell your items on our site<br>" + "Support Team " + "<br>" + "Universal Export mart";
string bdy = "Dear " + ar[1].ToString() + "<br>" + "Thanks for registration on Universal Export mart your password is " + ar[5].ToString() + " " + "we will give you a confirmation mail after that you can sell your items on our site<br>";
Mail.Body = bdy;

SmtpClient smtpMailObj = new SmtpClient();
//eg:localhost, 192.168.0.x, replace with your server name
smtpMailObj.Port = 465;
smtpMailObj.Host =
ConfigurationManager.AppSettings["Host"];
smtpMailObj.Credentials =
new System.Net.NetworkCredential(ConfigurationManager.AppSettings["AdminId"], ConfigurationManager.AppSettings["Password"]);

smtpMailObj.Send(Mail);
lblError.Text =
"Mail sent successfully";

Answers (1)