Skip to main content

Send-ModernMailMessage

SYNOPSIS

Sends an email message.

SYNTAX

Send-ModernMailMessage [[-Attachment] <String[]>] [[-Bcc] <String[]>] [[-Body] <String>] [-BodyAsHtml]
[[-Encoding] <Encoding>] [[-Cc] <String[]>] [[-DeliveryNotificationOption] <String[]>] [-From] <String>
[[-SmtpServer] <String>] [[-Priority] <String>] [[-ReplyTo] <String[]>] [[-Subject] <String>] [-To] <String[]>
[[-Credential] <PSCredential>] [-UseSsl] [[-Port] <Int32>] [-SaveToSentItems] [-RequestReadReceipt]
[-RequestDeliveryReceipt] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The Send-ModernMailMessage cmdlet sends an email message from within PowerShell.

EXAMPLES

EXAMPLE 1

Send-ModernMailMessage -From "user01@fabrikam.com" -To "user02@fabrikam.com" -Subject "Test mail"
Send-ModernMailMessage -From "user01@fabrikam.com" -To "user02@fabrikam.com" -Subject "Test mail" -SmtpServer smtp.contoso.com -UseSsl -Port 587

PARAMETERS

-Attachment

The path and file names of files to be attached to the email message.

Type: String[]
Parameter Sets: (All)
Aliases: Attachments

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Bcc

Email addresses that receive a copy of the mail but are not listed as recipients of the message. [Array] $Bcc,

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Body

The body (content) of the email message. [string[]] $Text,

Type: String
Parameter Sets: (All)
Aliases: Message

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-BodyAsHtml

Indicates that the value of the Body parameter contains HTML. [alias("Body")] [string[]] $HTML,

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Encoding

The encoding used for the body and subject. Explicitly reference System.Text.Encoding

Type: Encoding
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Cc

Email addresses to which a carbon copy (CC) of the email message is sent. [Array] $Cc,

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DeliveryNotificationOption

Delivery notifications (if accepted by the recipient) [System.Net.Mail.DeliveryNotificationOptions]$DeliveryNotificationOption, Explicitly reference System.Net.Mail Delivery notification options with validation

Type: String[]
Parameter Sets: (All)
Aliases: Dno

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-From

The address from which the mail is sent. [Parameter(Mandatory = $true)] [object] $From,

Type: String
Parameter Sets: (All)
Aliases: UserId

Required: True
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SmtpServer

Deprecated??

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Priority

The priority of the email message. [System.Net.Mail.MailPriority]$Priority, # Explicitly reference System.Net.Mail.MailPriority

Type: String
Parameter Sets: (All)
Aliases: Importance

Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ReplyTo

Specifies additional email addresses (other than the From address) to use to reply to this message [string] $ReplyTo,

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Subject

The subject of the email message. [string] $Subject,

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-To

The addresses to which the mail is sent [Array] $To, [Parameter(Mandatory = $true)]

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Credential

Deprecated?

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: 14
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-UseSsl

Deprecated?

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 15
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Port

Deprecated? [Parameter(Position = 15)] [Parameter(Mandatory = $false)]

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 16
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-SaveToSentItems

Indicates whether to save the message in Sent Items.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-RequestReadReceipt

Indicates whether a read receipt is requested for the message. ToDevelop:IsReadReceiptRequested

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-RequestDeliveryReceipt

Indicates whether a delivery receipt is requested for the message. ToDevelop: IsDeliveryReceiptRequested ToDevelop: Message ToDevelop: BodyParameter

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Fill ProgressAction Description

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

NOTES

Use "Enable-MailMessageAlias" to enable the command "Send-MailMessage".