Send-EWSmail Function

The Send-EWSmail function allows you to send mail without access to (or using) a SMTP server. Function has the ability to send email, with an optional attachement, using Exchange Web Services.


Microsoft Exchange Web Services Managed API
Mailbox hosted on Exchange or Exchange online (Office 365)

Change Log:

v1 - Initial version.

Examples of using the module (Source code of function is in attachment):  


Windows Shell Script
Function Send-EWSmail { 
  Function to send mail using Exchange Web Services 
  This function does not require access to SMTP. It does however need a valid Exchange user and makes use of 
  Microsoft Exchange Web Services Managed API. 
  Send-EWSmail -to "" -Subject "Automated mail" -Body "PowerShell and Exchange rock!" -Credential $Credential 
  Send-EWSmail -to ";" -Subject "Automated mail" -Body "The logfiles of today!" -Attachment "c:\temp\logfiles.txt" -Credential $Credential 
  Mail receipients. Can be multiple split by either , ; : or space. 
  .PARAMETER Subject 
  The subject of the mail 
  The body of the mail 
   .PARAMETER Attachment 
  Optional the path to an attachment. 
   .PARAMETER Credential 
  Valid user to send mail. eg $Credential = Get-Credential