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

You need to design a simple UI that allows you to enter an email recipient and a message, then click the send button to send the email


You should add a smtp setting to the app.config file which allows you to easily change it

<system.net>
    <mailSettings>
        <smtp from="your_email@gmail.com">
            <network host="smtp.gmail.com" port="587" userName="your_email@gmail.com" password="your_password" enableSsl="true" />
        </smtp>
    </mailSettings>
</system.net>

You can use MailMessage class to send a email, 587 is a gmail port

MailMessage mailMessage = new MailMessage { Subject = "your subject", Body = "your content" };
mailMessage.To.Add("your_email_receiver@gmail.com");
using (SmtpClient smtp = new SmtpClient()) {
    smtp.Send(mailMessage);
}