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

<system.net>
    <mailSettings>
        <smtp from="enter-your-email@gmail.com">
            <network host="smtp.gmail.com" port="587" userName="enter-your-email@gmail.com" password="enter-your-password" enableSsl="true" />
        </smtp>
    </mailSettings>
</system.net>

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

MailMessage mailMessage = new MailMessage {
    Subject = "c-sharpcode",
    Body = "Programming Tutorials"
};
mailMessage.To.Add("receiver-mail@gmail.com");
using (SmtpClient smtp = new SmtpClient()) {
    smtp.Send(mailMessage);
}

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