dovecot + Procmail -> junk emails

John Stoffel john at stoffel.org
Tue Aug 3 01:45:17 EEST 2021


>>>>> "Ted" == Ted Hatfield <ted at io-tx.com> writes:

Ted> On Mon, 2 Aug 2021, John Stoffel wrote:
>>>>>>> "Stephane" == Stephane Magnier <steph.mag220 at netcourrier.com> writes:
>> 
Stephane> Having moved from 'mbox' to 'Maildir', I'm trying to use a
Stephane> way to move a spam email to the Junk folder
>> 
>> Have you looked at 'sieve' and 'pigeonhole' setup?  procmail is old
>> old old and completely unsupported.
>> 
Stephane> I declared the junk folder as;
>> 
Stephane> namespace inbox {
Stephane> type = private
Stephane> disabled = no
Stephane> ignore_on_failure = no
Stephane>   list = yes
Stephane>     subscriptions = yes
Stephane> #hidden = no
Stephane> #inbox = yes
Stephane> #prefix = INBOX/
>> 
Stephane>   mailbox "Drafts" {
Stephane>       auto = subscribe
Stephane>     special_use = \Drafts
Stephane>   }
Stephane>   mailbox "Junk" {
Stephane>       auto = subscribe
Stephane>     autoexpunge = 12 weeks
Stephane>     special_use = \Junk
Stephane>   }
>> 
Stephane>   mailbox "Trash" {
Stephane>       auto = no
Stephane>     autoexpunge = 12 weeks
Stephane>     special_use = \Trash
Stephane>   }
>> 
Stephane>   mailbox "Sent" {
Stephane>       auto = subscribe
Stephane>     special_use = \Sent
Stephane>   }
>> 
Stephane> and spamassassin, very basic
>> 
Stephane> loadplugin Mail::SpamAssassin::Conf
>> 
Stephane> required_hits 5
Stephane> required_score 5
Stephane> rewrite_header subject [** SPAM ** ]
Stephane> add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=
Stephane> _AUTOLEARN_ version=_VERSION_
Stephane> spf_timeout 60
>> 
Stephane> rewrite_header to [Email could be SPAM ]
Stephane> fold_headers 0
Stephane> #defang_mime 0
Stephane> report_safe 0
>> 
Stephane> and Procmail.. basic and I used what I found  on the webpage :
Stephane> https://wiki.dovecot.org/procmail
>> 
>> This is probably old and should be removed or replaced.  I have
>> /etc/dovecot/conf.d/90-sieve.conf which looks like this:
>> 
>> plugin {
>> sieve = ~/.dovecot.sieve
>> sieve_dir = ~/sieve
>> sieve_global_dir =
>> sieve_before = /var/lib/dovecot/sieve/before.d
>> sieve_after = /etc/dovecot/sieve-after
>> sieve_extensions = +spamtest +spamtestplus
>> sieve_spamtest_status_type = score
>> sieve_spamtest_status_header = X-Spamd-Result: default: [[:alnum:]]+ [(-?[[:digit:]]+\.[[:digit:]]+) / -?[[:digit:]]+\.[[:digit:]]+\]
>> sieve_spamtest_max_header    = X-Spamd-Result: default: [[:alnum:]]+ [-?[[:digit:]]+\.[[:digit:]]+ / (-?[[:digit:]]+\.[[:digit:]]+)\]
>> }
>> 
>> And I have spamassissin scoring my mails, this script to move them
>> into 'Junk' as needed:
>> 
>> # more /etc/dovecot/sieve-after/spam-to-folder.sieve
>> require ["fileinto","mailbox"];
>> 
>> if header :contains "X-Spam-Flag" "YES" {
>> fileinto :create "Junk";
>> stop;
>> }
>> 

Ted> There are still a number of people using procmail.  Including me
Ted> for instance.  Rather than removing the page perhaps updating the
Ted> article with a reference to a replacement instead but leaving the
Ted> procmail documentation in place.

Certainly that's doable, but I don't have any access to that web page
for updates, but... I honestly haven't checked either!  LOL!  Just
replying from what I've seen over the years.

I too used to use procmail and it did a great job, but with Dovecot
and IMAP, having the integrated sieve protocol setup makes alot of
sense to keep down complexity.  Even thoguh you now have to learn a
new language to filter emails, but it's not that hard.

John



More information about the dovecot mailing list