Spamassassin and aliases

Potusek

Verified User
Joined
Nov 10, 2021
Messages
9
Hello

For one domain (let's assume domain.com) I have email boxes named email1, email2, email3... - client does not want to change it.
For these accounts there are aliases e.g. [email protected] and this works.
Unfortunately, there has been a problem with spamassassin, because instead of moving messages to a subfolder of a particular mailbox, spam is saved to the domain's root account.
Using the https://help.directadmin.com/item.php?id=156 documentation I currently have this code for exim.spamassassin.conf:
Bash:
# Spam Assassin
spamcheck_director:
  driver = accept
  condition = ${if !eq{$acl_m_spam_assassin_has_run}{1}}
  condition = ${if !eq{$acl_c_spam_assassin_has_run}{1}}
  condition = "${if and { \
                        {!eq {$received_protocol}{spam-scanned}} \
                        {!eq {$received_protocol}{local}} \
                        {exists{${extract{5}{:}{${lookup{${lookup{$domain}lsearch*{/etc/virtual/domainowners}{$value}}}lsearch{/etc/passwd}{$value}}}}/.spamassassin/user_prefs}} \
                        {exists{/etc/virtual/${domain}/passwd}} \
                        { \
                                or { \
                                        {!eq {}{${lookup{$local_part}lsearch{/etc/virtual/${domain}/passwd}}}} \
                                        {eq {$local_part} {${lookup{$domain}lsearch{/etc/virtual/domainowners}}}} \
                                } \
                        } \
                        {<{$message_size}{500k}} \
                } {1}{0}}"
  retry_use_local_part
  headers_remove = X-Spam-Flag:X-Spam-Report:X-Spam-Status:X-Spam-Level:X-Spam-Checker-Version
  transport = spamcheck
  no_verify
Unfortunately, in the logs I have:
Code:
failed to expand condition "${if and{{bool_lax{${if and{{bool_lax{${if !eq{$acl_m_spam_assassin_has_run}{1}}}}{bool_lax{${if !eq{$acl_c_spam_assassin_has_run}{1}}}}}}}}{bool_lax{${if and { {!def:h_X-Spam-Flag:} {!eq {$received_protocol}{spam-scanned}} {!eq {$received_protocol}{local}} {exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}} {exists{/etc/virtual/${domain}/passwd}} { or { {!eq {${lookup{$local_part}lsearch{/etc/virtual/${domain}/passwd}}}} {!eq {${lookup{$local_part}lsearch{/etc/virtual/${domain}/aliases}}}} {{eq {$local_part} {${lookup{$domain}lsearch{/etc/virtual/domainowners}}}}  } } {<{$message_size}{200k}} } {"1}{0}}}}}}" for spamcheck_director router: inside "or{...}" condition inside "and{...}" condition inside "and{...}" condition

what am i wrong with this configuration?
 
Hello,

Your Exim might be outdated. Just tested it out, and it's working fine with Exim version 4.96-58-g4e9ed49f8

p.s. I am aware the question was asked an year ago. I found this thread in Google, and tested the code snippet.
 
Back
Top