User Tools

Site Tools


doc:appunti:linux:sa:postfix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
doc:appunti:linux:sa:postfix [2022/01/20 10:06] – [Smarthost (relayhost)] niccolodoc:appunti:linux:sa:postfix [2022/05/24 09:50] – [Relay domains] niccolo
Line 697: Line 697:
 </file> </file>
  
-===== Relay domains =====+===== Relay by recipient domain =====
  
 To relay mail for non-local domains (domains not in ''mydestination'' and not in local virtual domains), use the **''relay_domains''** setting: To relay mail for non-local domains (domains not in ''mydestination'' and not in local virtual domains), use the **''relay_domains''** setting:
Line 726: Line 726:
 user@local.domain  smtp:remote.realay.host user@local.domain  smtp:remote.realay.host
 </file> </file>
 +
 +===== Relay by sender =====
 +
 +It is possibile to select a different relay path for messages based on sender address. Add the directive **sender_dependent_relayhost_maps** to **main.cf**:
 +
 +<code>
 +sender_dependent_relayhost_maps = hash:/etc/postfix/sender_dependent_relayhost_maps
 +</code>
 +
 +Each line of the file must contain a regular expression matching the sender address and the name or address of the relay host:
 +
 +<file>
 +username@rigacci.org     relay2.rigacci.org
 +*@domain2.org            relay3.rigacci.org
 +</file>
 +
 +Remember to recompile the file whenever you change it using **postmap** (no need to reload Postfix).
 +
 +All the standard requirements for a relay host are necessary. The relay host must be listed into the SPF record of the mail domain and the relay host should accept the original sender (e.g. via the **mynetworks** Postfix directive).
  
 ===== HELO hostname ===== ===== HELO hostname =====
doc/appunti/linux/sa/postfix.txt · Last modified: 2024/02/26 10:18 by niccolo