Dela via


Manage mail contacts in Exchange Online

In Exchange Online organizations, mail contacts are mail-enabled objects that contain information about people who exist outside your organization. Each mail contact has an external email address. For more information about mail contacts, see Recipients in Exchange Online.

You manage mail contacts in the Exchange admin center (EAC) or in PowerShell (Exchange Online PowerShell in organizations with Exchange Online mailboxes; standalone Exchange Online Protection (EOP) in organizations without Exchange Online mailboxes).

What do you need to know before you begin?

Use the Exchange admin center to manage mail contacts

Use the EAC to create mail contacts

  1. In the EAC, click Recipients > Contacts.

  2. Click Add a mail contact and configure the following settings in the details pane. Settings marked with an * are required.

    • Basic information: Update the following:

      • First name

      • Last name

      • Initials

      • *Display name: By default, this box shows the values from the First name, and Last name boxes. You can accept this value or change it.

      • *Alias:

      • *Email: Enter the user's email address. The domain should be external to your cloud-based organization.

    • Mail contact information (Optional)

    • Review mail contact

  3. When you're finished, click Create.

Use the EAC to modify mail contacts

  1. In the EAC, click Recipients > Contacts.

  2. In the list of contacts, select the mail contact by clicking anywhere in the row other than the button option that appears in the blank area next to the Display name column.

  3. In the Mail contact details pane, view or edit the user's contact details under the following sections:

    • General

    • Personal information

  4. When you're finished, click Save.

    Contact Information

    Use the Contact information section, to view, or edit the user's contact information. The information on this page is displayed in the address book.

    • Web site

    • Fax phone

    • Street

    • City

    • State/Province

    • ZIP/Postal code

    • Country/Region

    Organization Information

    Use the Edit Organization section, to record detailed information about the user's role in the organization. This information is displayed in the address book. Also, you can create a virtual organization chart that's accessible from email clients such as Outlook.

    • Title: Use this box to view or change the recipient's title.

    • Department: Use this box to view or change the department in which the user works. You can use this box to create recipient conditions for dynamic distribution groups, email address policies, or address lists.

    • Manager: To add a manager, enter the name and select from the drop-down list.

    • Direct reports: You can't modify this box. A direct report is a user who reports to a specific manager. If you've specified a manager for the user, that user appears as a direct report in the details of the manager's mailbox. For example, Kari manages Chris and Kate, so Kari is specified in the Manager box for Chris and Kate, and Chris and Kate appear in the Direct reports box in the properties of Kari's account.

Use the EAC to remove mail contacts

  1. In the EAC, click Recipients > Contacts.

  2. Select the mail contact that you want to remove, and then click Delete.

    Note

    EAC doesn't allow bulk edit of mail contacts yet.

  3. Click Confirm.

Use PowerShell to manage mail contacts

Use Exchange Online PowerShell to create mail contacts

This example creates a mail contact for Debra Garcia

  • The name and display name is Debra Garcia (if you don't use the DisplayName parameter, the value of the Name parameter is used for the display name).

  • The alias is dgarcia.

New-MailContact -Name "Debra Garcia" -ExternalEmailAddress dgarcia@tailspintoys.com -Alias dgarcia

For detailed syntax and parameter information, see New-MailContact.

Use Exchange Online PowerShell to modify mail contacts

In general, use the Get-Contact and Set-Contact cmdlets to view and change organization and contact information properties. Use the Get-MailContact and Set-MailContact cmdlets to view or change mail-related properties, such as email addresses, the MailTip, custom attributes, and whether the contact is hidden from address lists.

For more information, see the following articles:

Here are some examples of using Exchange Online PowerShell to change mail contact properties:

This example configures the Title, Department, Company, and Manager properties for the mail contact Kai Axford.

Set-Contact "Kai Axford" -Title Consultant -Department "Public Relations" -Company Fabrikam -Manager "Karen Toh"

This example sets the CustomAttribute1 property to a value of PartTime for all mail contacts and hides them from the organization's address book.

$Contacts = Get-MailContact -Resultsize unlimited
$Contacts | foreach {Set-MailContact -Identity $_ -CustomAttribute1 PartTime -HiddenFromAddressListsEnabled $true}

This example sets the CustomAttribute15 property to a value of TemporaryEmployee for all mail contacts in the Public Relations department.

$PR = Get-Contact -ResultSize unlimited -Filter "Department -eq 'Public Relations'"
$PR | foreach {Set-MailContact -Identity $_ -CustomAttribute15 TemporaryEmployee}

Use Exchange Online PowerShell to remove mail contacts

To remove a mail contact, use the following syntax:

Remove-MailContact -Identity <MailUserIdentity>

This example removes the mail contact for Pilar Pinilla:

Remove-MailContact -Identity "Pilar Pinilla"

For detailed syntax and parameter information, see Remove-MailContact.

How do you know these procedures worked?

To verify that you've successfully created, modified, or removed mail contacts, do any of the following steps:

  • In the EAC, click Recipients > Contacts. Verify the mail contact is listed (or not listed). The Contact Type value is MailContact. Select the mail contact from the list, by clicking anywhere in the row other than the button option that appears in the blank area next to the Display name column to view or edit the user's details.

  • In the Exchange Online PowerShell, replace <MailContactIdentity> with the name, email address, or alias of the mail contact, and run the following command to verify that the mail contact is listed (or not listed).

    Get-MailContact -Identity <MailContactIdentity> | Format-List Name,Alias,DisplayName,ExternalEmailAddress
    
  • In Exchange Online PowerShell, use the Get-Contact and Get-Contact cmdlets to verify the property changes you made.

    Get-MailContact | Format-List Name,CustomAttribute1,HiddenFromAddressListsEnabled
    
    Get-Contact -Filter "Department -eq 'Public Relations'" | Get-MailContact | Format-List Name,CustomAttribute15