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.Log.Clear(); try { imp.Connect("mail.domain.com"); imp.Login("your@account.com", "password"); FolderCollection col = imp.DownloadFolders(); imp.Disconnect(); 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.