As we saw in Chapter 2, Exchange Management Shell Common Tasks, we can use the PowerShell's built-in
Send-MailMessage cmdlet to send e-mail messages. This can be a useful tool when writing scripts that need to send notifications, but the EWS Managed API has several distinct advantages over this approach. In this recipe, we'll take a look at how to send e-mail messages through EWS and why this might be a better option for organizations that have an Exchange infrastructure in place.
Let's see how to send e-mail messages with EWS using the following steps:
ExchangeServiceclass, and set the EWS end point using AutoDiscover: