How to send email using gmail SMTP Server in Asp.Net?

In this article we will learn how to send email using gmail SMTP Server in ASP.Net.We will use Gmail service to send mail.
Send email in asp.net
In order to send emails with Gmail SMTP Server,what you will need is to have a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
First we will create a public method to send email and use this method in our C# code.


For learning purpose i have used email credentials in method itself.You can also set all settings in web.config file.
To use these Appsettings use below code in your C# code.

What you need is to use below two settings.Gmail always uses SSL/TLS authentication,hence you need to enable the SSL property on port 587 or 465 to send email in Asp.net using C# or VB.
Port – 587 or 465
EnableSsl – true


Hope you have liked this topic.


Thanks.

How to send email using gmail SMTP Server in Asp.Net? How to send email using gmail SMTP Server in Asp.Net? Reviewed by CodiBucket on 04:48 Rating: 5

No comments:

Facebook

Powered by Blogger.