On Thu, Aug 15, 2024 at 05:15:01PM -0400, Wietse Venema via Postfix-users wrote:
> Etienne Gladu via Postfix-users:
> > In short, I want postfix to change the recipient of all email going through
> > port 7025, 7026, etc
> > In exemple : email came from port 7025, then redirect/change recipient to
> > [email protected]
> > if its 7026, redirect/change recipient to [email protected]
>
> The client (and server port) are available in the SMTP policy
> delegation protocol.
>
> If you were to use the Perl code in the SMTPD_POLICY_RADME.html it
> might look like:
>
> if ($attr{'client_port'} == 7025) { print("action=redirect
> [email protected]\n\n"); }
The OP is probably interested in the 'server_port' rather than
the 'client_port'. Relevant policy request attributes include:
Postfix version 3.1 and later:
policy_context (see
https://www.postfix.org/postconf.5.html#smtpd_policy_service_policy_context)
Postfix version 3.2 and later:
server_address (Postfix SMTP service IP (v4 or v6) address)
server_port (Postfix SMTP service TCP port)
> But it may also be possible with postfwd, or with policy plugins in other
> languages.
>
> > Maybe it's just not possible with postfix?
>
> It is possible.
One can also override the restriction classes for each SMTP listener in
master.cf(5):
7025 inet ... smtpd
-o { smtpd_command_filter = pcre:{ {/^(MAIL FROM):/
$1:<[email protected]> } }
-o { smtpd_client_restrictions = check_client_access static:{REDIRECT
[email protected]} }
-o { smtpd_relay_restrictions = permit_mynetworks, reject }
-o { smtpd_helo_restrictions = }
-o { smtpd_sender_restrictions = }
-o { smtpd_recipient_restrictions = }
-o { smtpd_data_restrictions = }
-o { smtpd_end_of_data_restrictions = }
7026 inet ... smtpd
-o { smtpd_command_filter = pcre:{ {/^(MAIL FROM):/
$1:<[email protected]> } }
-o { smtpd_client_restrictions = check_client_access static:{REDIRECT
[email protected]} }
-o { smtpd_relay_restrictions = permit_mynetworks, reject }
-o { smtpd_helo_restrictions = }
-o { smtpd_sender_restrictions = }
-o { smtpd_recipient_restrictions = }
-o { smtpd_data_restrictions = }
-o { smtpd_end_of_data_restrictions = }
--
Viktor.
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]