Adding attachments to an email using Exchange Web Services

In a previous article on sending email with Exchange Web Services (EWS) we showed how easy it was to integrate with Exchange and send email. If you’ve ever wanted to attach a file to an email that your sending, it’s super easy (much faster than the System.Net.Mail method):

//Create an email message and identify the Exchange service
EmailMessage message = new EmailMessage(service);

//Attach a file - THE MAGIC
message.Attachments.AddFileAttachment(@"c:\temp\somefile.jpg");

//Send the email message and save a copy
message.SendAndSaveCopy();

That’s it! If you want to see all of the code needed for sending, see Retrieving and Sending Email using Exchange Web Services Managed API 2.0 (c#)

Adding attachments to an email using Exchange Web Services

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s