Using MailBee.NET Objects in Azure cloud

MailBee.NET Objects library is fully compatible with Microsoft Azure. You can use it just the same way you do on a normal PC.

For instance, let’s assume you have an ASP.NET MVC5 web app which you publish on Azure. You can modify Controllers/HtmlController.cs as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using MailBee;
using MailBee.ImapMail;

namespace WebApplicationAzure.Controllers
	public class HomeController : Controller
		public ActionResult Index()
			return View();

		public ActionResult About()
			ViewBag.Message = "Your application description page.";
			MailBee.Global.LicenseKey = "your key";
			Imap imp = new Imap();
			string logPath = Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, "log.txt");
			imp.Log.Filename = logPath;
			imp.Log.Enabled = true;
				imp.Login("", "password");
				FolderCollection col = imp.DownloadFolders();
				ViewBag.Message = $"Number of folders: {col.Count}, log path is {logPath}";
			catch (MailBeeException ex)
				ViewBag.Message = ex.ToString();
			ViewBag.Log = System.IO.File.ReadAllText(logPath);
			return View();

		public ActionResult Contact()
			ViewBag.Message = "Your contact page.";

			return View();

In Views/Home/About.cshtml, make sure you have Message and Log blocks.
Don’t forget to add a reference to MailBee.NET library via Nuget.
Now, when you publish the app and navigate to About page, this will display the number of folders in an IMAP account and the contents of the log file produced by MailBee.

Using MailBee.NET Objects in Azure cloud

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s