C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to send e-mail from ASP.NET


Posted Date: 05 May 2008    Resource Type: Definitions    Category: General

Posted By: karthik       Member Level: Diamond
Rating:     Points: 5



The following code sample shows how to send e-mail from an ASP.NET application?

MailMessage message = new MailMessage ();
message.From = ;
message.To = ;
message.Subject = "Scheduled Power Outage";
message.Body = "Our servers will be down tonight.";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send (message);
MailMessage and SmtpMail are classes defined in the .NET Framework Class Library's System.Web.Mail namespace. Due to a security change made to ASP.NET just before it shipped, you need to set SmtpMail's SmtpServer property to "localhost" even though "localhost" is the default. In addition, you must use the IIS configuration applet to enable localhost (127.0.0.1) to relay messages through the local SMTP service.




Responses

Author: Deepthi    05 May 2008Member Level: Silver   Points : 2
MailMessage mail = new MailMessage();
SmtpClient smtp = new SmtpClient();
mail.From = new MailAddress("");
mail.To.Add("");

mail.Subject = "Test";
mail.Body = "Hello this test mail";
smtp.Host = "mail.vassure.com";
//smtp.Host = "smtp.gmail.com";
smtp.Port = 2525;
smtp.EnableSsl = true;
smtp.Credentials = new System.Net.NetworkCredential("ur id", "pswd");
smtp.Send(mail);
Add name space using system.net.mail


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: authentication and authorization
Previous Resource: XmlSerializer
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

teleconferencing

Contact Us    Privacy Policy    Terms Of Use