Sending Emails Through SMTP in C#
Recently I was looking for some code for sending emails via SMTP in C#. Below are few links which I found with some reusable code. Overall it looks fine , but have to include multiple validations for error handling .
In Nutshell, flow is as below
- Define a function to send email which accepts an input Email object
- Validate the email object to ensure all mandatory fields are present and correct
- Create a new MailMessage object and SMTPClient Object and send email
Above gist links have some reusable code to achieve step 3 of above.