Commands › Exchange Online

New-MailContact

Exchange Online ExchangeOnlineManagement New-*

Create mail contacts.

Quick start script

# New-MailContact — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-MailContact
$before | Format-List

# 3. Make the change (dry run first)
New-MailContact -Name <String> -ExternalEmailAddress <ProxyAddress> -WhatIf
New-MailContact -Name <String> -ExternalEmailAddress <ProxyAddress>

# 4. Verify and diff
$after = Get-MailContact
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-MailContact -Name <String> -ExternalEmailAddress <ProxyAddress>
 [-Alias <String>]
 [-ArbitrationMailbox <MailboxIdParameter>]
 [-Confirm]
 [-DisplayName <String>]
 [-DomainController <Fqdn>]
 [-FirstName <String>]
 [-Initials <String>]
 [-LastName <String>]
 [-MacAttachmentFormat <MacAttachmentFormat>]
 [-MessageBodyFormat <MessageBodyFormat>]
 [-MessageFormat <MessageFormat>]
 [-ModeratedBy <MultiValuedProperty>]
 [-ModerationEnabled <Boolean>]
 [-OrganizationalUnit <OrganizationalUnitIdParameter>]
 [-PrimarySmtpAddress <SmtpAddress>]
 [-SendModerationNotifications <TransportModerationNotificationFlags>]
 [-UsePreferMessageFormat <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (20)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies the unique name of the mail contact. The maximum length is 64 characters. If the value contains spaces, enclose the value in quotation marks (").
-ExternalEmailAddress ProxyAddress yes The ExternalEmailAddress parameter specifies the target email address of the mail contact or mail user. By default, this value is used as the primary email address of the mail contact or mail user.
-Alias String The Alias parameter specifies the Exchange alias (also known as the mail nickname) for the recipient. This value identifies the recipient as a mail-enabled object, and shouldn't be confused with multiple email...
-ArbitrationMailbox MailboxIdParameter This parameter is available only in on-premises Exchange.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-DisplayName String The DisplayName parameter specifies the display name of the mail contact. The display name is visible in the Exchange admin center and in address lists. The maximum length is 256 characters. If the value contains...
-DomainController Fqdn This parameter is available only in on-premises Exchange.
-FirstName String The FirstName parameter specifies the user's first name.
-Initials String The Initials parameter specifies the user's middle initials.
-LastName String The LastName parameter specifies the user's last name.
-MacAttachmentFormat MacAttachmentFormat The MacAttachmentFormat parameter specifies the Apple Macintosh operating system attachment format to use for messages sent to the mail contact or mail user. Valid values are:
-MessageBodyFormat MessageBodyFormat The MessageBodyFormat parameter specifies the message body format for messages sent to the mail contact or mail user. Valid values are:
-MessageFormat MessageFormat The MessageBodyFormat parameter specifies the message body format for messages sent to the mail contact or mail user. Valid values are:
-ModeratedBy MultiValuedProperty The ModeratedBy parameter specifies one or more moderators for this mail contact. A moderator approves messages sent to the mail contact before the messages are delivered. A moderator must be a mailbox, mail user, or...
-ModerationEnabled Boolean The ModerationEnabled parameter specifies whether moderation is enabled for this recipient. Valid value are:
-OrganizationalUnit OrganizationalUnitIdParameter The OrganizationalUnit parameter specifies the location in Active Directory where the new contact is created.
-PrimarySmtpAddress SmtpAddress This parameter is available only in on-premises Exchange.
-SendModerationNotifications TransportModerationNotificationFlags The SendModerationNotifications parameter specifies when moderation notification messages are sent. Valid values are:
-UsePreferMessageFormat Boolean The UsePreferMessageFormat specifies whether the message format settings configured for the mail user or mail contact override the global settings configured for the remote domain or configured by the message sender....
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.