-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Feature: Support Reply-To field in Send-MailMessage #8719
Description
Summary of the new feature/enhancement
RFC 5322, section 3.6.2, defines the Reply-To field in a message like this:
When the "Reply-To:" field is present, it indicates the address(es) to which the author of the message suggests that replies be sent.
This field is used pretty frequently in larger organizations, and is respected by most e-mail clients as the default address to use for the default Reply action.
Currently, PowerShell's Send-MailMessage cmdlet doesn't provide a user the option to add this field. Users' current options are either to set the From field to the desired reply address, or go around Send-MailMessage to use the underlying System.Net.Mail.MailMessage class directly. The first is not an acceptable workaround in many cases, and the second requires the user to re-invent the wheel by recreating all of the behavior of Send-MailMessage.
As a user, I'd like to see a -ReplyTo parameter added to Send-MailMessage to allow me to use the Reply-To field directly within Send-MailMessage.
Proposed technical implementation details (optional)
The MailMessage class already supports the ReplyToList property, which is a MailAddressCollection just like the To, CC, and BCC fields (which are already supported and use a helper method to handle them). I'd suggest adding the -ReplyTo parameter to Send-MailMessage, adding support for the ReplyToList property to this helper function, and adding the plumbing to call that function with the value of Send-MailMessage's -ReplyTo parameter.
The end-user experience should look like this:
Send-MailMessage -To user@example.local -From FromUser@example.local -ReplyTo ReplyToUser@example.local,"Other User <[email protected]>" -Body $body