Welcome to Cup of Dev, the best blog by far!

All post publised as Morné Wolfaardt

Sending Email Using Office 365 Exchange Webservices Api

Sending email using C# is really easy, you can use the build in SMTP client // Setup mail message section MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress("[email protected]"); mailMessage.To.Add(new MailAddress("[email protected]"); mailMessage.Subject = "Test Message Subject"; mailMessage.Body = "HTML Body; mailMessage.IsBodyHtml = true; // Setup SMTP Client SmtpClient client = new SmtpClient(); client.Credentials = new NetworkCredential("", ""); client.Port = 587; client.Host = ""; client.EnableSsl = true; client.send(mailmessage); but using this method will send email using the SMTP setting for Exchange Online / Office 365.

Log Data to a File

You can easily write a collection of data to a log file by using System.IO.File.WriteAllLines method.System.IO.File.WriteAllLines The File.WriteAllLines method take two parameters, the output file and a collection of string entries. The method writes each entry on a new line. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace Cupofdev { class Cupofdev { static void Main(string[] args) { // Create a list and populate it. List<string> lstEntry = new List<string>(); lstEntry.