How do I send e-mail from an ASP.NET application ?



How do I send e-mail from an ASP.NET application ?..

Answer / kumar saurabh

MailMessage message = new MailMessage ();
message.From = <email>;
message.To = <email>;
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.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

How to find last error which occurred?

0 Answers  


Where on the Internet would you look for Web services?

5 Answers   IBM, MNC, Siebel Systems,


What is difference between machine.config and Web.Config?

4 Answers   Accenture, BirlaSoft, Le Logiciel,


What is data binding in asp net?

0 Answers  


Explain the significance of routing? : asp.net mvc

0 Answers  






how to pass session value one url to another url.my code if session("user")="abc" then response.redirect("www.abc.com\client\home.aspx") end if. so how to pass value of session in browser url

1 Answers  


How to retrieve user name in case of Window Authentication?

0 Answers  


What do you mean by authorization?

0 Answers  


What is a Metadata?

3 Answers  


what is page life cycle state management postback cross page postback types of feilds in gridview gridview events their life cycle cte in sql diff truncate and delete paging concepts in gridview diff bet gridview datalist and repeater what new operations in sql 2005 compared to earlier you get

1 Answers   e4e,


What is session in web technology?

0 Answers  


About web methods and its various attributes ?

1 Answers   Digital GlobalSoft,


Categories