This is a note to myself. I recently had to write this code for the third time in my life in the last 11 years because I did not save it somewhere consumable. So putting it on my blog for future reference.

Why Send Email From C# Code ?

There are many email automation services available – so why send email from your own C# code ? Well, there are a number of scenarios where you might want to write your own email sender. FOr example:

1. You want to monitor a new system you’re building while running long overnite tests.

2. You have a service that cannot be tested using off-the shelf software.

3. You want a special transient fault handling logic in your monitoring code

What are the key pieces of sending emails from C# code ?

You’ll need only a few basic things:

1. An www.outlook.com email and password

2. The following using directives in your C# code