BeanSoftware Logo
 

 
ASP.NET Database Search Control
 
 

 
 Home
    Shop
    Advertise
    Write For Us
    Affiliate
    Newsletter
    Contact

How To Send Email With ASP.NET?

To send simple e-mail, you can use this code:

[ C# ]

using System.Web.Mail;
 
...
 
MailMessage SimpleEmail = new MailMessage();
SimpleEmail.To = "info@beansoftware.com";
SimpleEmail.From = "admin@beansoftware.com";
SimpleEmail.Subject = "Hello World mail";
SimpleEmail.BodyFormat = MailFormat.Text;
SimpleEmail.Body = "E-mail is working!";
SmtpMail.SmtpServer = "yourMailServer";
SmtpMail.Send(SimpleEmail);

[ VB.NET ]

Imports System.Web.Mail
 
...
 
Dim SimpleEmail As New MailMessage()
SimpleEmail.To = "info@beansoftware.com"
SimpleEmail.From = "admin@beansoftware.com"
SimpleEmail.Subject = "Hello World mail"
SimpleEmail.BodyFormat = MailFormat.Text
SimpleEmail.Body = "E-mail is working!"
SmtpMail.SmtpServer = "yourMailServer"
SmtpMail.Send(SimpleEmail)



Related articles:

1. Build Notepad ASP.NET Web Application - part 2 of 2
2. .NET Framework Assemblies - Part 2

FAQ toolbar: Submit FAQ  |  Tell A Friend  |  Add to favorites  |  Feedback



Copyright © 2002-2008 Bean Software. All rights reserved.