Office 365 Email – Migrating .NET Code


Companies traditionally maintained their own SMTP servers for company email. With Office 365, that function can be offloaded to  the cloud-based email system that Microsoft fully maintains. Over the years, the cloud-based offering has matured and become very reliable.

The bulk of a migration involves reconfiguring users’ Outlook installations on their desktops. This post focuses on migrating .NET applications that programmatically send out email.

Although you can specify the email settings both through web.config and app.config files or programmatically in the code, it is much better to do it in the config file.

To mitigate the risk of such a migration, one could approach this project in two steps.

  1. Remove all hard-coding from the code and reference the SMTP element of the config file. Do this while still pointing to the on premise SMTP server and test it. More Info:
  2. Edit the SMTP element in the config file to point to the Office 365 server and test it.

Get the necessary settings by going to Office 365 Outlook and selecting:

  1. See All Options
  2. Account
  3. My Account
  4. Settings for SMTP access.

You’ll then have the server, port, user, and password

Potential pitfall. Ensure that the max number of daily emails sent configured in Office 365 matches the need of your business. This is especially important when unattended applications automatically generate emails and send them out.

More Resources:
Send emails through Office365/Exchange Online using .NET
Send Email using Hotmail/Live/Office 365 in C#

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>