Print Add to Favorites   Back
Sending Email From ASP.NET Version 2/3+

Article Information
Article ID: 84
Author: Support @ CCS
Created: 11/15/2007
Modified: 11/15/2007
Views: 2,366

Sending Email From ASP.NET Version 2/3+


ASP.NET is Microsoft’s revolutionary web application technology. ASP.NET has many features built in which other web language framworks don’t support, for example AJAX and drag-n-drop technologies.

In this article you will learn how to send emails from an ASP.NET (.aspx) page.

Note: This will only work with version 2.0+ of the framwork.

1) Import the mail namespace into the page.

2) Create the sub-routine that will send the email.

Sub SendEmail(ByVal Sender As Object, ByVal e As EventArgs)

End Sub

To send the mail on page load use the follow sub-routine.

Sub PageLoad(ByVal Sender As Object, ByVal e As EventArgs)

End Sub

Note: All sub-routines must be surrounded by the following tags.

3) Declare the appropriate variables.

Dim msg As MailMessage = new MailMessage()
Dim smtp As New SmtpClient(””)

4) Start adding the appropriate details.

msg.From = new MailAddress(”“, “From Person”)
msg.To.Add(new MailAddress(”“, “Recipient”))
msg.IsBodyHtml = “False”  ‘Set this to “True” if the message body will be HTML.
msg.Body = “Email Body”
msg.Subject = “The Subject”

5) Send the email.


That’s how to send an email using ASP.NET 2.0 (+)!


For details of the options available for  CCS Company Website Hosting click here

This URL: