# Send-MtMail

Send an email with the summary of the Maester test results

Source: https://maester.dev/docs/commands/Send-MtMail

## SYNOPSIS

Send an email with the summary of the Maester test results

## SYNTAX

```powershell
Send-MtMail [-MaesterResults] <PSObject> [-Recipient] <String[]> [-Subject <String>] [-TestResultsUri <String>]
 [-CreateBodyOnly] [-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 app needs permission to send from a mailbox,
see https://maester.dev/docs/alerts/email for instructions.

## EXAMPLES

### EXAMPLE 1

```powershell
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`

```yaml
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.
john@contoso.com

```yaml
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'.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -TestResultsUri

Absolute HTTP or HTTPS URI to the detailed test results page.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -CreateBodyOnly

Does not send the email, but outputs the body to use elsewhere

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
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.
Accepts either a GUID or UPN (User Principal Name) format.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

```yaml
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### System.Collections.Hashtable

## NOTES

## RELATED LINKS

[https://maester.dev/docs/commands/Send-MtMail](https://maester.dev/docs/commands/Send-MtMail)
