0

I'm using Exim with Cpanel. I created email forwarding from 'email@example.com' to 'forward@example.com' and 'email2@example.com' to 'forward2@example.com'.

I want to filter only emails that are forwarded so if a user sends an email to 'email@example.com' no thing would happen but on forwarding this email to 'forward@example.com' I want to filter it.

I can't do that:

if ("$h_to:, $h_reply_to:" contains "forward@example.com")

because I don't want to target emails sent directly to 'forward@example.com'.

I tried to create .forward file in /home/ and in /home/user/ but it's not doing anything.

I created a filter file:

touch /usr/local/cpanel/etc/exim/sysfilter/options/forward_filter

and enabled it I just need the condition to target the forwarded emails only.

mm1234
  • 1
  • Wouldn't it be better to handle this in a *message delivery agent* (MDA) like Sieve or Procmail? – Esa Jokinen Jul 18 '23 at 11:09
  • 1
    If the forwarding is done by Exim, you can set any `r_*` variable in the `redirect` driver, and check for that variable in the ACLs (specifically in `predata`, `data`, and `data_prdr`). You can add headers to the message in the ACLs, which makes it trivial to filter the messages later in any MDA. Unfortunately I don't know how to specify all of these when cPanel is involved, but there might be similar settings. – Lacek Jul 18 '23 at 11:18
  • @EsaJokinen I'm new to Linux servers and I think Cpanel doesn't have any of these MDA. Is it possible to add one of them to work with Cpanel and Exim? – mm1234 Jul 18 '23 at 11:19
  • @Lacek Actually I want to use filters to add/remove headers because forwarding is not working with SES as the sender email has to be verified. So if an email is forwarded from 'user@example.com' to 'email@mydomain.com' it won't be forwarded as 'user@example.com' is not verified with SES as it's impossible to verify all users sending us emails. – mm1234 Jul 18 '23 at 11:22
  • We don't really deal with web hosting control panels here, so I don't know what's possible. We know about configurating the actual server software. Unfortunately, I know more about Postfix than Exim. – Esa Jokinen Jul 18 '23 at 12:41
  • @EsaJokinen Thanks, I tried to update the headers most of them are updated except `Return-Path` and `Received` SES SMTP still detects the sender email somehow maybe from `Return-Path` although I removed it and added a new one but it exists like 3 times 2 of them from the real sender – mm1234 Jul 18 '23 at 12:59

0 Answers0