Sending emails in ASPX

This is a really simple one, but I have seen a lot of people asking so I thought I'd write a quick tip for it.

A lot of people will advise you to create an instance of System.Web.Mail.MailMessage and then send it using System.Web.Mail.SmtpServer, but there is a much more simple way.

System.Web.Mail has a class SmtpMail.  This class has a static method named "Send".  To send an email it is as simple as doing this...

System.Web.Mail.SmtpMail.Send(to, from, subject, body);

 

Share this article!

Follow us!

Find more helpful articles: