This post describes an easy way to send a email using a smtp server.
To create a smtp client, we need to specify a smtp host and port, port is an optional parameter.
for some Smtp clients, we need to provide credintials. we need a NetworkCredintial instance for that. We can use Secure Socket Layer (SSL) to encrypt the connection.
This shows how to instantiate a smtp client, If you are using gmail, host is smtp.gmail.com or else some specific smtp server. If port is available, specify the port
After working with Smtp client, then we need is MailMessage object.
MailMessage from and to should be MailAddress instances.
In this example we used IsBodyHtml attribute, to notify mail body can be a html string.
You can clone sample code from this github repository and play with it, https://github.com/hansamaligamage/Scheduler