Re: Best practise question: getmail and unwanted emails

Martin Gregorie <[email protected]> Mon, 09 Nov 2020 18:47:42 +0000
Newsgroups gmane.mail.getmail.user
Organization Martin Gregorie
Message-ID <[email protected]>
On Mon, 2020-11-09 at 18:47 +0100, [email protected] wrote:
> But what's the best way for filtering out missed spam when getmail is
> fetching them to IMAP/dovecot? Any best practices you could / may want
> to share?
> 
What are you doing with messages after getmail has fetched them? 

It sounds as though you're passing them directly to Dovecot for
delivery. If that's the case, you can just add Spamassassin (SA) and a
filter to form a pipeline from getmail to Dovecot:

- use Spamassassin as your local spam trap. There is more than one way
  of doing that:
  - run spamassasin as a link in your pipeline
  - run Spamassassin as a server and put spamc in the pipeline instead
    of spamassassin. Both work, so use which one you prefer.
  
- SA adds headers to the message saying whether its ham or spam and,
  saying which SA rules it triggered.

- you need another program that inspects messages output by
  spamc/spamassassin. This should pass ham to Dovecot for delivery and 
  junks or quarantines spam. 

  Quarantine is a good idea because it gives you a second chance to look
  as misclassified spam, read it and correct your local SA rules as
  needed. If you quarantine ham, its a good idea to include the time and
  date in the filename and set up a cronjob to delete quarantined spam
  after 'n' days. n=7 works for me. 
  
  Either write your own spam hsandling programs programs or look at
  mine, which are at https://www.libelle-systems.com/free/
 
  spamkiller is the spam/ham selector

  spamscan is a dropin for logwatch which reports spam and ham stats for
  the previous 24 hours 
 
Martin