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