X-Spam header tag

liorm

Verified User
Joined
Feb 2, 2012
Messages
28
Hello all,

I am using an external service which is able to tag spam message header with x-spam, as well as to tag the subject with [spam].
My goal is to find a way to move these tagged messages to a Junk/Spam folder in the user mailbox.

1. No all mailboxes have the the Junk folder.
2. How can I make exim watch the spam tag and move the message to s designated pre-created spam folder?

No spamassassin installed.

Thanks in advance.. :)
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,128
Location
GMT +7.00
Hello,

This is how it does Directadmin with user level filters:

Code:
if    $h_X-Spam-Status: contains "Yes,"
then
    if
        $local_part is "[B]userbob[/B]"
    then


        save /home/[B]userbob[/B]/Maildir/.INBOX.spam/new/ 660
    else
        if "${if exists{/home/[B]userbob[/B]/imap/${domain}/${local_part}}{yes}{no}}" is "yes"
        then
            save /home/[B]userbob[/B]/imap/$domain/$local_part/Maildir/.INBOX.spam/new/ 660
        else
            save /home/[B]userbob[/B]/Maildir/.INBOX.spam/new/ 660
        endif


    endif
    finish
endif
userbob is a fake username here. So update it to meet your needs and if you manage to write a global rule which would not contain a username then you could place it in /etc/system_filter.exim
 
Last edited:

liorm

Verified User
Joined
Feb 2, 2012
Messages
28
Thanks for that Alex.
Will this create the junk folder in case it does not exist?
Will this apply to all mailboxes in the account?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,128
Location
GMT +7.00
You're welcome. I've posted the way how directadmin does it, so that's up to you to modify it to meet your needs.
Please feel free to test it and find answers on your questions by yourself.
If you want me to write the 100% suitable solution for you then contact me privately for a quote.

System filters placed in /etc/system_filter.exim are applied to all incoming emails for all users on a server.
For further reading you can use this link: http://www.exim.org/exim-html-current/doc/html/spec_html/filter_ch-exim_filter_files.html
 
Top