O'Reilly logo

Microsoft Exchange Server PowerShell Cookbook - Third Edition by Mike Pfeiffer, Jonas Andersson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending e-mail messages with EWS

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.

How to do it...

Let's see how to send e-mail messages with EWS using the following steps:

  1. First, we'll import the EWS Managed API assembly, create an instance of the ExchangeService class, and set the EWS end point using AutoDiscover:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required