Enable a user to "Send As" an  alternate address with Office 365 or Exchange Online

Published:
Powershell credentials promptNormally, an Office 365 user cannot an email with a “from” address other than their own primary email address.  The closest thing available via the web admin interface sends email “on behalf of” another address.  But in some cases we want one user to be able to send email with different “from” addresses, so the recipients sees only the alternate address.
 
If you do need to set up an alternate “send from” address for a user, here is an outline of how to do it.

1.  Create a distribution group with the desired email address
2.  Make the user a member of the distribution group (so replies will go to them)
3.  Allow external users to send email to this distribution group
4.  Grant permission to send as this distribution group to the user

That fourth step, granting permission to “send as,” cannot be performed using the Office 365 web interface.  Fortunately, you can also administer your Office 365 accounts using PowerShell.  The PowerShell commands that follow illustrate how to do all of these operations listed above.

If you have not used PowerShell to manage Office 365 before, you may run into some difficulties creating a remote PowerShell session for the first time.  To be able to establish the connection to Exchange Online, you may need to execute the following commands in a Windows command prompt that is Run as Administrator

>net start winrm
>winrm get winrm/config/client/auth

If this does not show that Basic authentication is already enabled for WinRM, then execute the command:
>winrm set winrm/config/client/auth @{Basic="true"}

One last complication:  You will be able run those WinRM get and set commands only if you are logged on as the local Administrator account or if you have set the following registry value  to “1”
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] LocalAccountTokenFilterPolicy

Now here are the Powershell commands.  Be sure to replace the initial variable values with strings appropriate for your case.

Note that, when you run this code, Windows will open a “Windows PowerShell Credential Request” prompt.  You must provide your Office 365 administrator username and password.




# 
                      $User = “username@your.office365.domain”
                      $Alias = “sendingas@any.domain.supported.by.your.office365.configuration”
                      #
                      #
                      ################################################################
                      #  Connect Powershell session to Exchange Online
                      #  This will open a “Windows PowerShell Credential Request” prompt.
                      #  You must logon with your Office 365 administrator account.
                      #################################################################
                      #
                      # Allow execution of remote (signed) scripts from Exchange Online
                      Set-Executionpolicy RemoteSigned -Scope process -Force
                      # Prompt user for login name/password
                      $LiveCred = Get-Credential
                      # Connect to Exchange Online
                      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
                      # Load Powershell commands from Exchange Online
                      Import-PSSession $Session
                      #
                      #
                      ################################################################
                      # Create distribution group and give permissions to appropriate user
                      ################################################################
                      #
                      New-DistributionGroup $Alias -PrimarySMTPAddress $Alias -Members $User
                      Add-RecipientPermission $Alias -accessrights sendas -trustee $User  -Confirm:$false
                      Set-DistributionGroup $Alias -RequireSenderAuthenticationEnabled $false -Confirm:$false
                      #
                      #
                      ################################################################
                      #  Close PowerShell Exchange Online session
                      #################################################################
                      #
                      Remove-PSSession $Session

Open in new window

2
9,661 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.