How to tips and tricks for Microsoft Visual Studio .net

Thursday, May 7, 2015

Microsoft Exchange Web Services – Sending an E-Mail


Before you start find out that comes before this by checking out this post first:
Microsoft Exchange Web Services – First things first


One of the more obvious things that you might want to do with EWS is send an e-mail.

  Dim subject As String = "Your subject"  
  Dim html_Content As String = "<div style=""font-family:Arial;font-size:10pt;color:black"">Insert your html content for your e-mail here</div>"  
  Dim _SendTo As String = "email@address.com"  
   
  Dim replyMessage As New Microsoft.Exchange.WebServices.Data.EmailMessage(_service)  
  replyMessage.Subject = subject  
  replyMessage.Body = html_Content  
  replyMessage.ToRecipients.Add(_SendTo)  
   
  replyMessage.SendAndSaveCopy()  
   

This code snippet will send an e-mail to the address that you specify. Remember to use the code in the post referenced at the top of this post.

More posts about Exchange Web Services will follow.

Please let me know if you found this info helpful.

No comments:

Post a Comment