In this tutorial, I'll show you how to send a email using smtp gmail in C#.NET

Open your app.config file, then add the following code to configuration your email account

        <smtp from="[email protected]">
            <network host="" port="587" userName="[email protected]" password="enter-your-password" enableSsl="true" />

Next, We will use the MailMessage class to send an email

MailMessage mailMessage = new MailMessage {
    Subject = "c-sharpcode",
    Body = "Programming Tutorials"
mailMessage.To.Add("[email protected]");
using (SmtpClient smtp = new SmtpClient()) {

As you know, MailMessage class represents the email we want to send via SMTP