Skip to content

Feature: Support Reply-To field in Send-MailMessage #8719

@replicaJunction

Description

@replicaJunction

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    First-Time-IssueEasy issues first time contributors can work on to learn about this projectIssue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions