Send Email with Gmail SMTP using C#

dotnetetc.com- C# Send Mail

Today we be using c# to send email with Gmail SMTP. Gmail is probably the most used email service in the world.

SMTP stands for Simple mail transfer protocol.This protocol is used to send emails.

We will be creating a console application to send the mails.So lets step by step.

Step 1: Open visual studio and create a console application.

Step 2: Add new class file with name GEmail.cs and add below code in the same.

Step 3: Add below code in the Program class of the console application

Step 4. Run the application by pressing Ctrl+F5. Enter all the details asked by the program like send email,recipient email etc. If the programs runs success fully and email is send the a message “Mail send” will appear in output. In case of any exception the relevant message will be shown using catch block.

You can download the source code : Download

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*