none
add a secondary SMTP address mail @domain2.com for all user @domain1.com

    Question

  • Hi guys,

    does anyone know the commands that would give add a secondary smtpAddress @domain2.com for all users with a specific domain @domain1.com

    Thanks in advance

    Friday, July 13, 2018 11:22 AM

Answers

All replies

  • Hi,

    Normally you would configure it using Email Address Policies and add the domain there as an secondary address. You can find more about Email Address Polices here: 

    https://docs.microsoft.com/en-us/Exchange/email-addresses-and-address-books/email-address-policies/email-address-policies

    You could also do it for a single mailbox as well, both using ECP and PowerShell by following this article:

    https://docs.microsoft.com/en-us/exchange/recipients/user-mailboxes/email-addresses

    If you want do to do it one time only and for multiple users, you can use the following commands:

    $mailboxes = Get-Mailbox | Where-Object {$_.PrimarySmtpAddress -like "*@domain1.com"}
    foreach ($mailbox in $mailboxes)
    {
    	$mailboxalias = $mailbox.alias + "@domain2.com"
    	$mailbox | Set-Mailbox -EmailAddresses @{add="$mailboxalias"} -WhatIf
    }

    If have added -WhatIf so it will not perform any change and you can verify it in your environment before you commit the change. 

    Friday, July 13, 2018 11:38 AM
  • Thanks a lot for your answer JOEL. I'll perform this and revert if it's ok  :) :)

    Thanks again

    Friday, July 13, 2018 11:43 AM
  • Hi Slimhss,

    I'm just writing to check how's everything going? If you have any questions or needed further help on this issue, please feel free to post back. If the issue has been resolved, please mark the helpful replies as answers, this will make answer searching in the forum easier and be beneficial to other community members as well. Thanks for your understanding.


    Best Regards,
    Niko Cheng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Friday, July 20, 2018 8:33 AM
    Moderator