How to Send Email in ASP.Net Core 2.0

With the release of .Net Core 2.0, SmtpClient is now available. It is identical to what was there in full .Net framework. Ideally, the code to send email using SmtpClient you might have written in .Net framework should work in .Net Core 2.0 pretty much by copy-pasting.