Re: [Exim] System-wide spam handling, with opt-out possibili…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Stian Grytoyr
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [Exim] System-wide spam handling, with opt-out possibility
Stian Grytoyr <stian.grytoyr@???> writes:

|  - Make Exim deliver mails that are tagged as spam into a
|    Maildir subfolder, i.e ~/Maildir/.spam/.

|
|  - ...but only if the file ~/.optout-spam does not exist. If
|    it does, follow the normal delivery process, i.e. check
|    for .procmailrc, Exim filter and so on.

|
| Non-spam should be processed in the normal way. Ideally,
| Exim should also check for the existence of the spam folder,
| and create it if it doesn't exist. But that's not a
| requirement, just a bonus if it is possible.


OK, I ended up with the solution below. I'm sending it here
in case it might be useful for others, and to see if anyone
spots some gross error which I haven't thought of:

The router:

  spam:
    driver = accept
    check_local_user
    require_files = ${local_part}:+!${home}/.optout-spam
    condition = ${if eq {${substr_0_5:$header_X-NR-MailScanner-SpamScore:}}{sssss}{Yes}{No}}
    transport = spam_delivery


The transport:

  spam_delivery:
    driver = appendfile
    directory = /nr/user/$local_part/Maildir/.NR-Spam
    maildir_format = yes
    delivery_date_add
    envelope_to_add
    return_path_add


This solution even creates the spam folder if it doesn't
exist, so all my requirements (and bonus wishes) are met :)

Thanks to Jonathan Vanasco and Boris Kovalenko.

--
Regards,
Stian Grytoyr