Skip to main content

Send-MtMail

SYNOPSIS

Send an email with the summary of the Maester test results

SYNTAX

Send-MtMail [-MaesterResults] <PSObject> [-Recipient] <String[]> [-Subject <String>] [-TestResultsUri <String>]
[-UserId <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Uses Graph API to send an email with the summary of the Maester test results.

This command requires the Mail.Send permission in the Microsoft Graph API.

When running interactively this can be done by running the following command:

Connect-MtGraph -SendMail

When running in a non-interactive environment (Azure DevOps, GitHub) the Mail.Send permission must be granted to the application in the Microsoft Entra portal.

EXAMPLES

EXAMPLE 1

Send-MtMail -MaesterResults $MaesterResults -Recipient john@contoso.com, sam@contoso.com -Subject 'Maester Results' -TestResultsUri "https://github.com/contoso/maester/runs/123456789"

Sends an email with the summary of the Maester test results to two users along with the link to the detailed test results.

PARAMETERS

-MaesterResults

The Maester test results returned from Invoke-Pester -PassThru | ConvertTo-MtMaesterResult

Type: PSObject
Parameter Sets: (All)
Aliases:

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

-Recipient

The email addresses of the recipients. e.g. [email protected]

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

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

-Subject

The subject of the email. Defaults to 'Maester Test Results'.

Type: String
Parameter Sets: (All)
Aliases:

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

-TestResultsUri

Uri to the detailed test results page.

Type: String
Parameter Sets: (All)
Aliases:

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

-UserId

The user id of the sender of the mail. Defaults to the current user. This is required when using application permissions.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
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

OUTPUTS

NOTES