Hi,
Having moved from 'mbox' to 'Maildir', I'm trying to use a way to move a spam email to the Junk folder
I declared the junk folder as;
namespace inbox {
type = private
disabled = no
ignore_on_failure = no
list = yes
subscriptions = yes
#hidden = no
#inbox = yes
#prefix = INBOX/
mailbox "Drafts" {
auto = subscribe
special_use = \Drafts
}
mailbox "Junk" {
auto = subscribe
autoexpunge = 12 weeks
special_use = \Junk
}
mailbox "Trash" {
auto = no
autoexpunge = 12 weeks
special_use = \Trash
}
mailbox "Sent" {
auto = subscribe
special_use = \Sent
}
and spamassassin, very basic
loadplugin Mail::SpamAssassin::Conf
required_hits 5
required_score 5
rewrite_header subject [** SPAM ** ]
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_
tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_
spf_timeout 60
rewrite_header to [Email could be SPAM ]
fold_headers 0
#defang_mime 0
report_safe 0
and Procmail.. basic and I used what I found on the webpage :
https://wiki.dovecot.org/procmail <https://wiki.dovecot.org/procmail>
DELIVER="/usr/lib/dovecot/deliver -d $LOGNAME"
SHELL="/bin/bash"
SENDMAIL="/usr/sbin/sendmail -oi -t"
LOGFILE="/var/log/procmail.log"
DEFAULT="/var/spool2/mail/%u
:0fw
| /bin/spamc -s any
#######################################
#:0
#* ^X-Spam-Status: Yes
#$DEFAULT
#######################################
:0 w
* ^X-Spam-Status: Yes
| $DELIVER -m Junk
#
## deliver to INBOX and stop
# deliver to INBOX and stop
:0 w
| $DELIVER
But with this config, a spam email, stay into the Inbox :-(
/var/log/procmail.log... doesn't exist
Thanks for you help
"Stephane" == Stephane Magnier <steph.mag220@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
On Mon, 2 Aug 2021, John Stoffel wrote:
"Stephane" == Stephane Magnier <steph.mag220@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
John,
There are still a number of people using procmail. Including me for instance. Rather than removing the page perhaps updating the article with a reference to a replacement instead but leaving the procmail documentation in place.
Ted
"Ted" == Ted Hatfield <ted@io-tx.com> writes:
Ted> On Mon, 2 Aug 2021, John Stoffel wrote:
> "Stephane" == Stephane Magnier <steph.mag220@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
participants (3)
-
John Stoffel
-
Stephane Magnier
-
Ted Hatfield