O'Reilly logo

Pro Windows PowerShell by Hristo Deshev

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

18.4. Working with Message Headers

Frequently, we need to set our message with additional headers that will signal the priority, Reply-To address, and many other things that we, our mail client, or our mail server can recognize, such as a request for sending back a message read notification. The message priority and Reply-To address are conveniently exposed as properties of the MailMessage class:

$message.Priority = [System.Net.Mail.MailPriority] "High"
$message.ReplyTo = test2@deshev.com

To accommodate setting those properties in our script, we need to add two more parameters: $priority and $replyTo. They default to $null and an empty string respectively, and we need to add some checks to skip configuring them if the parameters have not been ...

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