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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to implement globalization and localization in the use interface in .net.

534


What is datagrid asp.net?

495


What is the difference between system.stringbuilder and system.string

260


Why cyclomatic complexity is important?

555


What is rending process in ASP.NET?

615






What is the full meaning of asp.net?

524


What is the difference between pathparam and queryparam?

576


Explain about Multi-Language integration?

599


List the events in page life cycle.

551


Which object wraps the state or data of a user?

545


What permissions do asp.net applications posses by default?

644


What is custom attribute?

569


What is the use of autowireup in asp.net?

560


Explain the difference between singleton and single call?

532


How can you implement the postback property of an asp.net control?

527