< Back

Send-MgaMailMessage

Sat Jan 18, 2020 4:42 pm

NAME Send-MgaMailMessage



SYNOPSIS

Send message(s) in Exchange Online using the graph api.





SYNTAX

Send-MgaMailMessage -Subject <String[]> [-Body <String>] -ToRecipients <String[]> [-CCRecipients <String[]>]

[-Sender <String>] [-From <String>] [-BCCRecipients <String[]>] [-ReplyTo <String[]>] [-Categories <String[]>]

[-Importance <String>] [-InferenceClassification <String>] [-IsDeliveryReceiptRequested <Boolean>]

[-IsReadReceiptRequested <Boolean>] [-SaveToSentItems <Boolean>] [-User <String>] [-Token <AzureAccessToken>]

[-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]



Send-MgaMailMessage [-Message] <MessageParameter[]> [-User <String>] [-Token <AzureAccessToken>] [-PassThru]

[-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Send a previously created draft message(s) and save the message in the SendItems folder.

Alternatively, the command can directly send a message by specifing a recipient, subject, ...





PARAMETERS

-Message <MessageParameter[]>

Carrier object for Pipeline input.

This can be the id of the message or a message object passed in.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Subject <String[]>

The subject of the new message.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Body <String>

The body of the message.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ToRecipients <String[]>

The To recipients for the message.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CCRecipients <String[]>

The Cc recipients for the message.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Sender <String>

The account that is actually used to generate the message.

(Updatable only when sending a message from a shared mailbox or sending a message as a delegate.

In any case, the value must correspond to the actual mailbox used.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-From <String>

The mailbox owner and sender of the message.

Must correspond to the actual mailbox used.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BCCRecipients <String[]>

The Bcc recipients for the message.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ReplyTo <String[]>

The email addresses to use when replying.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Categories <String[]>

The categories associated with the message.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Importance <String>

The importance of the message.

The possible values are: Low, Normal, High.



Required? false

Position? named

Default value Normal

Accept pipeline input? false

Accept wildcard characters? false



-InferenceClassification <String>

The classification of the message for the user, based on inferred relevance or importance, or on an explicit

override.

The possible values are: focused or other.



Required? false

Position? named

Default value other

Accept pipeline input? false

Accept wildcard characters? false



-IsDeliveryReceiptRequested <Boolean>

Indicates whether a delivery receipt is requested for the message.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-IsReadReceiptRequested <Boolean>

Indicates whether a read receipt is requested for the message.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-SaveToSentItems <Boolean>

Indicates whether to save the message in Sent Items.

Only needed to be specified if the parameter should be $false, default is $true.



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-User <String>

The user-account to access. Defaults to the main user connected as.

Can be any primary email name of any user the connected token has access to.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Token <AzureAccessToken>

The token representing an established connection to the Microsoft Graph Api.

Can be created by using New-MgaAccessToken.

Can be omitted if a connection has been registered using the -Register parameter on New-MgaAccessToken.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

Outputs the token to the console



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

If this switch is enabled, no actions are performed but informational messages will be displayed that explain

what would happen if the command were to run.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

If this switch is enabled, you will be prompted for confirmation before executing any operations that change

state.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

MSGraph.Exchange.Mail.Message





NOTES





For addiontional information about Microsoft Graph API go to:

https://docs.microsoft.com/en-us/graph/ ... h-rest-1.0

https://docs.microsoft.com/en-us/graph/ ... h-rest-1.0



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$mail | Send-MgaMailMessage



Send message(s) in variable $mail.

also possible:

PS C:\\> Send-MgaMailMessage -Message $mail



The variable $mail can be represent:

PS C:\\> $mail = New-MgaMailMessage -ToRecipients 'someone@something.org' -Subject 'A new Mail' -Body 'This is a

new mail'











RELATED LINKS