Send SMTP email using System.Net.Mail via Exchange Online (Office 365)

Fixed a few typos in the working code above: MailMessage msg = new MailMessage(); msg.To.Add(new MailAddress(“[email protected]”, “SomeOne”)); msg.From = new MailAddress(“[email protected]”, “You”); msg.Subject = “This is a Test Mail”; msg.Body = “This is a test message using Exchange OnLine”; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(“your user … Read more

Reading e-mails from Outlook with Python through MAPI

I had the same problem you did – didn’t find much that worked. The following code, however, works like a charm. import win32com.client outlook = win32com.client.Dispatch(“Outlook.Application”).GetNamespace(“MAPI”) inbox = outlook.GetDefaultFolder(6) # “6” refers to the index of a folder – in this case, # the inbox. You can change that number to reference # any other … Read more

Read MS Exchange email in C#

It’s a mess. MAPI or CDO via a .NET interop DLL is officially unsupported by Microsoft–it will appear to work fine, but there are problems with memory leaks due to their differing memory models. You could use CDOEX, but that only works on the Exchange server itself, not remotely; useless. You could interop with Outlook, … Read more