Send email with smtp authentication using ASP.NET

Following Codes demonstrates how to send an email with SMTP Authentication using ASP.NET:

`//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("[email protected]");
//IMPORTANT: This must be same as your smtp authentication address.
mail.To.Add("[email protected]");

//set the content
mail.Subject = "This is an email";
mail.Body = "This is from using C sharp with smtp authentication.";
//send the message
SmtpClient smtp = new SmtpClient("");

//IMPORANT:  Your smtp login email MUST be same as your FROM address.
NetworkCredential Credentials = new NetworkCredential("[email protected]", "password");
smtp.Credentials = Credentials;
lblMessage.Text = "Mail Sent";`

NOTE: Please note that you cannot use System.Net.Mail.SmtpClient to send an e-mail message with Implicit SSL.

For more details please click Sending e-mails using ASP and CDOSYS.