> ## Documentation Index
> Fetch the complete documentation index at: https://kb.mochahost.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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("[postmaster@yourdomain.com](mailto:postmaster@yourdomain.com)");\
//IMPORTANT: This must be same as your smtp authentication address.\
mail.To.Add("[postmaster@yourdomain.com](mailto:postmaster@yourdomain.com)");

//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("[postmaster@yourdomain.com](mailto:postmaster@yourdomain.com)", "password");\
smtp.Credentials = Credentials;\
smtp.Send(mail);\
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](https://clientarea.mochahost.com/knowledgebase/480).
