Plus addressing (also known as sub-addressing) is a powerful email feature that allows users to append a '+' suffix to their username with arbitrary tags. For example:
myname+newsletters@domain.com myname+shopping@domain.com
Despite these variations, all emails get delivered to the primary mailbox (myname@domain.com). This creates several advantages:
- Automatic email categorization without server-side rules
- Identifying sources of spam/leaks by unique tags
- Creating temporary addresses without provisioning new mailboxes
Microsoft Exchange Server has traditionally NOT supported plus addressing out-of-the-box. Unlike Sendmail and other SMTP servers, Exchange requires specific configuration:
# PowerShell command to check if plus addressing is enabled Get-OrganizationConfig | Select-Object DisablePlusAddressInRecipients
Option 1: Transport Rule Configuration
Create a transport rule to handle plus addresses:
New-TransportRule -Name "PlusAddressRewrite"
-RecipientAddressMatchesPatterns '^([^+]+)\+[^@]+@domain\.com$'
-SetHeaderMessage "X-Original-To" "HeaderValue"
-SetEnvelopeRecipient '${1}@domain.com'
Option 2: Custom Mail Flow Processing
For more advanced scenarios, implement an Exchange agent:
public class PlusAddressAgent : SmtpReceiveAgent
{
public PlusAddressAgent()
{
this.OnEndOfData += OnEndOfDataHandler;
}
private void OnEndOfDataHandler(ReceiveMessageEventSource source, EndOfDataEventArgs e)
{
var recipient = e.MailItem.Message.To[0].Address;
if (recipient.Contains("+"))
{
var baseAddress = recipient.Substring(0, recipient.IndexOf("+")) + "@domain.com";
e.MailItem.Message.To.Clear();
e.MailItem.Message.To.Add(new MailAddress(baseAddress));
}
}
}
If native Exchange configuration isn't feasible, consider these workarounds:
- Configure a mail gateway (like Exchange Online Protection) to handle plus addressing
- Use mail-enabled contacts with specific address policies
- Implement a custom SMTP receive connector with address rewriting
After implementation, verify with these PowerShell commands:
Test-Mailflow -TargetEmailAddress "test+validation@domain.com" Get-MessageTrackingLog -Recipients "test@domain.com" -StartDate (Get-Date).AddHours(-1)
Check message headers for proper handling of the plus address in the X-Original-To header.
Microsoft Exchange Server doesn't natively support plus addressing (+tag) functionality like Sendmail does. The "+" character isn't treated as a special delimiter in Exchange's email routing engine. However, there are several alternative approaches to achieve similar functionality:
You can create transport rules to handle plus addresses, though this requires explicit configuration for each variation:
New-TransportRule -Name "PlusAddressing"
-RecipientAddressMatchesPatterns '^(.+)\+.*@domain\.com$'
-CopyToMessageHeader "X-Original-To"
-SetHeaderName "To"
-SetHeaderValue '$1@domain.com'
A more flexible approach involves using mail flow rules with regex pattern matching:
# PowerShell script for Exchange Management Shell
$rule = New-TransportRule -Name "PlusAddressHandler"
-Priority 0
-Enabled $true
-RecipientAddressMatchesPatterns '^(?[^+]+)(\+[^@]*)?@domain\.com$'
-SetHeaderName "X-Original-Recipient"
-SetHeaderValue '$0'
-SetHeaderName "To"
-SetHeaderValue '${user}@domain.com'
For more sophisticated implementations, consider:
- Custom SMTP Receive Connector with address rewriting
- Third-party add-ons like CodeTwo Email Address Manager
- Pre-processing via Edge Transport server
Here's a complete PowerShell script that implements plus addressing with logging:
# Exchange Plus Addressing Implementation
$logPath = "C:\ExchangeLogs\PlusAddressing.log"
$domain = "yourdomain.com"
function Log-Message {
param([string]$message)
"$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $message" | Out-File $logPath -Append
}
try {
$rule = Get-TransportRule "PlusAddressHandler" -ErrorAction SilentlyContinue
if (-not $rule) {
New-TransportRule -Name "PlusAddressHandler"
-RecipientAddressMatchesPatterns "^(.+)\+.*@$domain$"
-SetHeaderName "X-Original-To"
-SetHeaderValue '$0'
-SetHeaderName "To"
-SetHeaderValue '$1@$domain'
-Comments "Handles plus addressing similar to Sendmail"
Log-Message "Plus addressing rule created successfully"
}
else {
Set-TransportRule "PlusAddressHandler"
-RecipientAddressMatchesPatterns "^(.+)\+.*@$domain$"
Log-Message "Plus addressing rule updated"
}
}
catch {
Log-Message "Error configuring plus addressing: $_"
throw
}