dovecot + Procmail -> junk emails
John Stoffel
john at stoffel.org
Mon Aug 2 20:57:12 EEST 2021
>>>>> "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;
}
Cheers,
John
More information about the dovecot
mailing list