Sending Emails With ASP.Net

If you haven’t checked into it yet, there are several things that have changed from ASP.Net1.1 and ASP.Net 2.0, concerning email, however, it’s still not very complicated.

The first thing you’ll notice is that the namespace has changed from System.Web.Mail to System.Net.Mail. Also, now, to get the email working, there are two classes that need to be addressed:

  • MailMessage()
  • SmtpClient()

To use these, it will look something like this:

Dim Msg as MailMessage = new MailMessage()
Dim MailObj As New SmtpClient("mail.YourDomain.com")

Now – to add your To and From addresses, the Subject, Body and Body type, you’d do something like this:
Continues…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>