Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| tutorial:mail:postfixrelay [2013-08-18 00:45] – root | tutorial:mail:postfixrelay [2025-06-16 14:42] (current) – removed weichbr | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{tag> | ||
| - | ====== Let postfix only accept mails for addresses in Exchange ====== | ||
| - | |||
| - | ===== Problem ===== | ||
| - | * I use postfix as a backup for my Exchange. I want postfix to only accept mail for recipients which exist in Exchange. | ||
| - | |||
| - | ===== Requirements ===== | ||
| - | * I assume you followed my first tutorial [[tutorial: | ||
| - | * Existing postfix installation (mine is on debian) | ||
| - | * Existing Exchange (2010 or 2013) installation | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ===== Step 1 ===== | ||
| - | |||
| - | |||
| - | |||
| - | * Create the following PowerShell script on your Exchange server: | ||
| - | * < | ||
| - | $ExcludeUsers = @(" | ||
| - | |||
| - | Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 | ||
| - | |||
| - | # Get all valid recipients, excludes DiscoverySearchMailbox and every user alias included in ExcludeUsers | ||
| - | $ValidRecipients = Get-Mailbox | where {$_.Alias -NotLike " | ||
| - | foreach ($Address in $ValidRecipients.EmailAddresses) | ||
| - | {[string]:: | ||
| - | </ | ||
| - | * Run the script and save the output to a file like this: '' | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ===== Step 2 ===== | ||
| - | * Connect to yout server running postfix | ||
| - | * Upload the scriptoutput to / | ||
| - | * Add the following lines to your / | ||
| - | * < | ||
| - | relay_recipient_maps = hash:/ | ||
| - | show_user_unknown_table_name = no | ||
| - | </ | ||
| - | * Reload or restart postfix | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ===== Step 3+ ===== | ||
| - | * If your addresses change (added new or removed some) you have to repeat step 1 and 2 | ||