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
//set the addresses
mail.From = new MailAddress("[email protected]"); //IMPORTANT: This must be same as your smtp authentication address.
//set the content
mail.Subject = "This is an email";
mail.Body = "This is from system.net.mail using C sharp with smtp authentication.";
//send the message
SmtpClient smtp = new SmtpClient("mail.yourdomain.com");
//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 clich HERE.