Page 1 of 1

Use of .forward file

Posted: Mon Sep 01, 2025 1:49 pm
by darden
Hello there,

I'm checking the use of exim4 filters with the .forward file, under the user Maildir folder, p.e:

Code: Select all

/home/user/mail/domain.com/account/.forward
With no luck. The sample forward is:

Code: Select all

# Exim filter

if $header_From: contains "[email protected]"
then
  testprint "from=$header_From to=$h_To"
  save /home/user/mail/domain.com/account/.Test/
  finish
endif
The Test folder exists, and contain {new, cur, etc} subfolders.

Code: Select all

sudo -u user /usr/sbin/sendmail -bf /home/user/mail/domain.com/account/.forward -f [email protected] < test-email.eml 
Seems Ok, as it says test-email would be moved to the desired folder.

But when i try to check the filter with a mail, nothing happens. Am I missing something?

Edit: Debian 11 with Exim 4.94.2

Re: Use of .forward file

Posted: Mon Sep 01, 2025 6:02 pm
by darden
Ok, a more in depth check about this.

Code: Select all

sudo exim -d -bt "[email protected]" 2>&1
Will throw the userforward router with:

Code: Select all

userforward router skipped: account is not a local user
I guess .forward filtering won't work with virtual accounts, just for system accounts.

Re: Use of .forward file

Posted: Wed Sep 03, 2025 10:19 pm
by merle4127
You’re right—.forward only works for real system users, not virtual mail accounts. for virtual mailboxes, exim ignores it. the easy fix is to use dovecot sieve filters instead, since they work at the user level and can move mails into folders like test without touching exim configs.