CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Friday, April 06, 2007

Sending EMAIL in ASP.NET


//SmtpMail.SmtpServer = "127.0.0.1";


SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer"];


System.Web.Mail.MailMessage msgMail = new System.Web.Mail.MailMessage();





msgMail.From = txtFrom.Text.ToString();


msgMail.To = txtTo.Text;


msgMail.Cc = txtC.Text;


msgMail.Bcc = txtBcc.Text;


msgMail.Subject = txtSubject.Text;


msgMail.Body = txtMessage.Text;


msgMail.Attachments.Add(new MailAttachment(txtAttachment.Text));


SmtpMail.Send(msgMail);


 

Post a Comment