Authenticate Emails in ASP.NET Using SMTP

Nowadays, you need to enable SMTP authentication for all emails send from your hosting account. It is easy to enable SMTP in case if you make use of e-mail clients such as Outlook. However, you should provide the required authentication code if you attempt to send an e-mail through ASP.NET web form.

ASP.NET 4.5 has simplified the process of SMTP authentication when compared to prior versions, which make use of CDO object.

(1) You need to create an object of smtpClient() and pass the required mail server as parameter

Dim smtp As New SmtpClient(“mail.abcd.com”)

(2) Pass your mail account username and password to NetworkCredential() object

smtp.Credentials = New NetworkCredential(“mails@abcd.com”, “Your Password”)

You have to replace the domain – abcd.com and Your Password with your correct credentials.

Your emails will now be authenticated.

Leave a Reply