Wednesday, October 8, 2014

Send email using Mail API in C#

Because I couldn't find anything online, here's my contribution to the community. This code snippet shows you how to send a message using the C# SDK for the Exchange Mail REST API.

IMessage message = new Message();
Recipient recipient = new Recipient();
recipient.Name = "abcde";
recipient.Address = "abcde@12345.onmicrosoft.com";
ItemBody body = new ItemBody();
body.Content = "Hey!";
message.Body = body;
message.ToRecipients.Add(recipient);
await mailClient.Me.Messages.AddMessageAsync(message);

No comments:

Post a Comment