Yes you can do this: In acl_rcpt:
warn domains = <YOURDOMAIN> remove_header = dkim-signature remove_header = arc-seal remove_header = arc-authentication-results remove_header = arc-message-signature In acl_data: warn condition = ${if match {$recipients}{<YOURDOMAIN\\.YOURTLD>\$}{yes}{no}} condition = ${if !def:h_reply-to:} add_header = Reply-To: $h_from: In your redirect router: sender_redirect: driver = redirect domains = <YOURDOMAIN> data = ${lookup{$local_part}lsearch{/etc/forwards}} errors_to = $local_part@<YOURDOMAIN> set = r_orep=${lookup{$local_part}lsearch{/etc/forwards}} set = r_isfwd=true In your Remote_SMTP transport: remote_smtp: debug_print = "T: remote_smtp for $local_part@$domain" driver = smtp dkim_sign_headers = from:date:to:cc dkim_domain = <YOURDOMAIN> dkim_selector = <YOURSELECTOR> dkim_private_key = /etc/exim4/dkim.key dkim_canon = relaxed headers_rewrite = *@* "${if eq {$r_isfwd}{true}{$return_path}fail}" fs : *@* "${if eq {$r_isfwd}{true}{\"Forwarded Email\" <$r_orep>}fail}" tw This will rewrite envelope sender to the $local_part@<YOURDOMAIN> (by setting errors_to), then It will rewrite MIME From to $local_part@<YOURDOMAIN>, then it will rewrite To: to become "Forwarded Email" <[TARGET_ADRESS]>. It will also dump any DKIM or ARC signatures from original sender, instead you sign mail yourself. >>> This will pass servers/senders even with strict alignment. <<< A forwarded email as this, with forwarded_user having a forward to "somewh...@gmail.com" will become: MAIL FROM: youru...@server.com RCPT TO: forwarded_u...@example.org From: youru...@server.com To: forwarded_u...@example.org Will become: MAIL FROM: forwarded_u...@example.org RCPT TO: somewh...@gmail.com From: forwarded_u...@example.org To: somewh...@gmail.com Reply-To: youru...@server.com (If Reply-To on sending mail is already set, it will not be replaced). -----Ursprungligt meddelande----- Från: Mihamina RKTMB via Exim-users <exim-users@lists.exim.org> Skickat: den 5 november 2023 18:49 Till: exim-users@lists.exim.org Ämne: [exim] Handle sender on forwarding Hi all, I have an Exim installation where I just setup aliases. exim.conf: [...] local_domains= @:myfoobar.com [...] aliases: [...] mihamina:rakotomandi...@gmail.com [...] In other words, if I send a message to miham...@myfoobar.com, it gets forwarded to rakotomandi...@gmail.com. When I test, the sender is miham...@atscom.io and the receiver is miham...@myfoobar.com. The message is effectively forwarded to rakotomandi...@gmail.com, but the "From:" header is kept to miham...@atscom.io. The problem: GMail rejects the message because my Exim server sends a message with a "From:" set to miham...@atscom.io but atscom.io's SPF does not allow this server to send such messages. I have no authority on senders domains SPF (that's fair). I guess there is a setting I have to set on Exim in order to fix this? Regards -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/ -- ## subscription configuration (requires account): ## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/ ## unsubscribe (doesn't require an account): ## exim-users-unsubscr...@lists.exim.org ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/