Practical PowerShell Exchange Online,PowerShell Plus Addressing and Emails with ‘+’ (Exchange Online)

Plus Addressing and Emails with ‘+’ (Exchange Online)


Office 365 Changes

Recently Microsoft added support for what is known as “+” email addresses or dynamic email addresses. This feature was the number one rated feature in User Voice and thus Microsoft brought the idea to fruition. Using plus addresses is a common way to help separate out and organize email traffic based on what address an email was sent to. Exchange Online supports email addresses that contain a plus sign, but this is not Plus Addressing. The logic for Exchange Online is something line this:

Normal, supported email addresses:
[sourcecode]
<alias>@<domain>
[/sourcecode]
Plus Addresses look like this:
[sourcecode]
<alias>+<tag>@<domain>
[/sourcecode]

PowerShell

As this feature is off by default, we need to turn this on like so:
Set-OrganizationConfig -AllowPlusAddressInRecipients $True
This will enable the Plus Addressing feature. With this enabled, if you had signed up for a newsletter or provided your email address for marketing material in a form like this +@domain.com, then when an email is received, Microsoft will resolve it like so:
[sourcecode]
<alias>@domain.com
[/sourcecode]

Example

Let’s say we have a user who only has email aliases without ‘+’ addresses would like to sign up for some monthly material, but would like to keep these emails segregated into different folders. He wants to do this with Plus Addresses of Newsletter, Marketing and Amazon. He then signs up for these services providing these email addresses:
[sourcecode]
Ted+newsletter@powershellgeek.com
Ted+marketing@powershellgeek.com
Ted+amazon@powershellgeek.com
[/sourcecode]
We have two ways to enable this to work for our end user. We can:

* Add these email addresses as aliases to his mailbox
* Enable Plus Addressing for Exchange Online

The far easier option is to choose the Plus Addressing option as it allows for dynamic options, less administrative overhead and a ‘self-servicing’ model. Now if an email comes in and Ted has a rule to process it, the email will go to the appropriate folder:


Notice the plus address in the To: field. This is a valid email address that Exchange Online has now accepted and used in rule processing for this mailbox.

Caveats

There are caveats to this, so if you already have plus addresses in your environment, prior to turning this feature on, it could cause issues as the email addresses will be viewed differently once that switch it turned on. For example:

User has this alias pre-change:

[sourcecode]
<em>Ted+technews@powershellgeek.com</em><BR>
[/sourcecode]
Exchange Online will interpret this as:

[sourcecode]
<em>Ted+technews@powershellgeek.com or <alias>@<domain></em><BR>
[/sourcecode]
When we turn on Plus Addressing, Exchange Online will interpret this address like so:

[sourcecode]
<em>Ted@powershellgeek.com or <alias>+<tag>@<domain></em><BR>
[/sourcecode]
If this user does not have an alias of ‘Ted@powershellgeek.com’ the email will fail to be delivered. In the end, know your environment before making this change as it could have unseen side effects. You may want to verify no plus addresses are currently in use in your environment. PowerShell can help you determine this.
[sourcecode language=”powershell”]
$Mailboxes = Get-Mailbox -ResultSize Unlimited
$PlusCount = 0
Foreach ($Mailbox in $Mailboxes){
$EmailAddresses = $Mailbox.EmailAddresses
If ($EmailAddresses -like ‘*+*’) {
$PlusCount++
}
}
[/sourcecode]
An environment with zero Plus Addressing in place would have a $PlusCount variable value of zero as none would be found. Otherwise this number would increment based on the number of aliases found. If some were found, then further analysis may be required to determine who has a Plus Address.
[sourcecode language=”powershell”]
Foreach ($Mailbox in $Mailboxes) {
$EmailAddresses = $Mailbox.EmailAddresses
$DisplayName = $Mailbox.DisplayName
If ($EmailAddresses -like ‘*+*’) {
Foreach ($EmailAddress in $EmailAddresses) {
If ($EmailAddress -like ‘*+*’) {
Write-Host “$DisplayName , $EmailAddress”
}
}
}
}
[/sourcecode]
Feedback, when a matching alias is found, looks like this:


As we can see, a matching email address was found. Now you have code to help analyze your Exchange Online tenant for ‘+ addresses … which if you don’t makes your tenant a good candidate to enable this feature.

Related Post