Exim4 inbound/outbound mapping

Hi everybody,

I have a question about Exim4 address mapping — sorry in advance if it sounds a bit complicated :blush:

I have three email addresses on a single domain: [email protected], [email protected], and [email protected]. I’m also using Gmail, so all emails are being forwarded to their respective Gmail addresses.

Currently, I’ve set up inbound forwarding via the Hestia panel as follows:

[email protected][email protected] + [email protected]
[email protected][email protected] + [email protected]
[email protected] ------> [email protected]

Additionally, in /etc/exim4/exim4.conf.template (between the send_via_smtp_relay: and dnslookup: sections), I’ve added the following for outbound emails:

bcc_user_x:
driver = redirect
allow_fail
allow_defer
no_verify
no_expn
unseen
condition = ${if eq{$sender_address}{[email protected]}{true}{false}}
data = [email protected]

bcc_user_y:
driver = redirect
allow_fail
allow_defer
no_verify
no_expn
unseen
condition = ${if eq{$sender_address}{[email protected]}{true}{false}}
data = [email protected]

so whatever being sent or received from/to x and y will be also forwarded to z.
This setup is working quite well overall. However, I’ve noticed a problem when [email protected] puts x or y in the CC of email:

[email protected] ([email protected]) ---------> [email protected]
CC |--------> [email protected]
CC |--------> [email protected]

I have multiple questions about this:

  1. Could this scenario create a loop in Exim?
  2. If [email protected] has a DMARC policy, I’ve noticed that the emails forwarded back from x and y to [email protected] sometimes get frozen with the following error:

SMTP error from remote mail server after end of data: 550-5.7.26 Unauthenticated email from anotherdomain.tld is not accepted due to\n550-5.7.26 domain’s DMARC policy.

I suspect that SRS is not functioning properly during the forwarding step, so Gmail sees the email as if it was sent by anotherdomain.tld instead of domain.tld.

Do you have any ideas or suggestions on how to fix this?

Thanks in advance for your time and help!


Update 1: I made a mistake, This has nothing to do with the emails forwarded back fromxandyto[email protected] , The problem is with the bounce messages coming back from anotherdomain.tld
Update 2: I believe this is a bug, I know that the bounce messages are supposed to be managed by exim4 with SRS. Somehow this is not happening with the bounce messages coming back from DMARC reject policy enabled domains. The Hestia rules in exim4 are successfully manage to receive them but it is supposed to be forwarded to 3rd party mail server like Gmail, Exim can’t rewrite the sender so Gmail thinks my server trying to send an email (bounce) behalf of DMARC enabled domain which is forbidden.