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

What is validation in asp.net?

0 Answers  


Why mvc is better than asp.net? : Asp.Net MVC

0 Answers  


What is smpte vc-1?

0 Answers  


What is inheritance and an how it be used, example with an example?

0 Answers   Siebel,


what is command line compiler.what are the steps and how it is related to debugging.

0 Answers  


Suppose there is one web farm with 3 servers inside with same configuration and the same project is running inside all servers.Which session mode is usde for all these and why?

3 Answers  


How Clustered Index and Non clustered index stored on SQL server?

2 Answers   TCS,


Given an ASP.NET Web Form called WebFrom1, what class does the WebForm1 class inherit from by default? a) System.Web.Form b) System.Web.GUI.Page c) System.Web.UI.Page d) System.Web.UI.Form

3 Answers   Syntax Softtech,


How do you design a website with multilingual support in ASP.NET ?

0 Answers   MCN Solutions,


What is X-Path?

2 Answers   Sherston,


What is boxing?

8 Answers   IBM, Misys, Siebel Systems,


What are Http handler ?

1 Answers   Patni,


Categories