.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Code Snippets >> Email >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Sending Mail in asp.net

Posted By:Syed Shakeer Hussain       Posted Date: June 19, 2010    Points: 5    Category: Email    URL: http://www.dotnetspark.com  

Sending Mail using asp.net

Below is the code used to send Email using Asp.Net
//SmtpMail.SmtpServer = "";

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));



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend