MailMessage mail = new MailMessage();
mail.To.Add(txtUM.Text);
mail.From = new MailAddress("pavan.it30@gmail.com");
mail.Subject = "Welcome To NL SOFTTECH SERVICES!!";
string Body = "User ID :"+txtUI.Text+" Password :"+txtPass.Text;
mail.Body = Body;
mail.IsBodyHtml = true;
//mail.Attachments.Add(
SmtpClient smtp = new SmtpClient();
smtp.Host = ConfigurationManager.AppSettings["SMTP"];
smtp.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]);
smtp.EnableSsl = true;
smtp.Send(mail);
Label1.Text = "Mail Sent Successfully";
and add this tag in web.config
<appSettings>
<!--<add key="SMTP" value="smtp.gmail.com"/>
<add key="FROMEMAIL" value="pavan.it30@gmail.com"/>
<add key="FROMPWD" value=""/>-->
</appSettings>
No comments:
Post a Comment