Cyrus (Sieve) and external programs

Niels Dettenbach nd at syndicat.com
Wed May 30 05:42:14 EDT 2018


Am Mittwoch, 30. Mai 2018, 10:44:09 CEST schrieb Pedro silva:
> Ive seen something like this in other distributions (eg.:
> https://wiki.dovecot.org/HowTo/AntispamWithSieve) I was just
> wondering if the same is possible with cyrus or cyrus sieve.


Just for reading mail files into i.e. spamassassin efficently periodically (in a 
small to "large" amount of mailboxes) you could do things (by i.e. cron) 
like:

 - for a "few hundreds" mailboxes (as long as the shell did not complain a to 
long result list) by cron:

	spam-learn /var/spool/imap/user/*/SpamLearn/*.

for i.e. a cyrus imap Folder called "SpamLearn" (i.e. auto-created in every 
mailbox). You possibly have to adapt the whole path to your config/setup.

 - or for much more of, do a loop over:

	for each user:
	spam-learn /var/spool/imap/user/$user/Spam/*.

In a 2nd step you may delete the Spam folder content by a little imap script 
to avoid re-reading yet processed mails. "spam-learn" is a script / program 
which reads emails direcftly fom files.

seems a bit ugly, but works very efficient on filesystem level. It sepends from 
the filesystem layer how powerful this could be for you.

- If you want to avoid cron and process "instantly" you may use the notifier 
principle as described from Pedro to start such a script for a single mailbox 
if /at least one) mail is placed in that Folder..

- It should be possible to to use inotify or similiar filesystem notification 
features to start such a script too.


I'm personally do not like "spam training" by users as this often leads to 
bad / not valuable results, as many typical end users (by my experience) 
misunderstand what "spam" (technically) is (and/or change their mind about). 
I.e. they use "forwarded" "spam" fom any external mail sevice/pop, regular 
list mail fom a company (which all is a valid mail). Such things leads to 
false positives or (if less weighted) just not useful processing overhead. 
But this may depend fom the practical application (i do not use Spam marking 
("Spam Folder") - just bouncing - as checking Spam Folders costs the end user 
additional work time if they rely on email....


good luck.
best regards,


niels.
-- 
 ---
 Niels Dettenbach
 Syndicat IT & Internet
 http://www.syndicat.com
 PGP: https://syndicat.com/pub_key.asc
 ---
 








More information about the Info-cyrus mailing list