MailBee. NET Objects Tutorials

Using OAuth 2.0 authentication with Gmail.com and Outlook.com

MailBee.NET Objects allows for authentication via OAuth 2.0, the approach works for various mail servers and email services, you can find sample for Gmail.com at OAuth2 Class documentation page.

There is extensive OAuth 2.0 tutorial with C# and VB samples for Windows and ASP.NET. It targets the latest technologies including .NET Framework 4.5. If you're working with .NET Framework 3.5, see the samples below (C# syntax).

This approach works for Outlook.com as well. You can download complete sample of this.

Note that the above sample requires supplying email address explicitly, and the token issued will expire in 1 hour. If you require email autodetection, or token autorefresh, use the Advanced OAuth2 sample instead. In addition to dealing with IMAP, this sample works with SMTP as well.

To use OAuth2, you will need to register your application at https://account.live.com/developers/applications/create. Connect to Outlook.com IMAP using OAuth 2.0 MSDN page describes the approach in detail.