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="">
            <network host="" port="587" userName="" 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"
using (SmtpClient smtp = new SmtpClient()) {

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