Evaggelos Balaskas - System Engineer

The sky above the port was the color of television, tuned to a dead channel

Blog
Posts
Wiki
About
Contact
rss.png twitter linkedin github gitlab profile for ebal on Stack Exchange

You can use vim to crash a server »
  -  
« Why donate some money for opensource project is important
Jan
05
2011
Use gmail to educate spamassassin
Posted by ebal at 10:22:42 in planet_ellak, planet_Sysadmin

It is a known fact that gmail’s spam filters get the job done.
I am working with spamassassin on local mail setups and i want spamassasin to learn automatically from my gmail Spam folder.

So is it possible?

Of course it is possible.

First we have to get all the mails from our gmail account into a local dummy mail account (easy we’ll use getmail) and then we have to educate spamassasin from our local dummy mail account (sa-learn).

one config file and two commands via cron will do the work.

First the getmailrc (i shall not bother with the getmail & spamassassin installation or setup).

/root/.getmail/getmailrc



[options]
delete = false
message_log = /var/log/getmail.log
verbose = 0
read_all = false

[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
mailboxes = ("[Gmail]/Spam",)
username = username@example.com
password = XXXXXXXXXXXXXXX

[destination]
type = Mboxrd
path = /var/spool/mail/gmail_spam
user = nobody

So now when we execute: getmail
every new mail is gmail spam folder will be downloaded into /var/spool/mail/gmail_spam

Next we need to execute sa-learn


sa-learn --spam --mbox /var/spool/mail/gmail_spam

Thats it!

Simple as that!

Dont forget to add the below cron entries:


@daily getmail &> /dev/null
@daily sa-learn --spam --mbox /var/spool/mail/gmail_spam &> /dev/null
You can use vim to crash a server »
  -  
« Why donate some money for opensource project is important

Search

Admin area

  • Login

Categories

  • blog
  • wiki
  • pirsynd
  • midori
  • books
  • archlinux
  • movies
  • xfce
  • code
  • beer
  • planet_ellak
  • planet_Sysadmin
  • microblogging
  • UH572
  • KoboGlo
  • planet_fsfe

Archives

  • 2025
    • April
    • March
    • February
  • 2024
    • November
    • October
    • August
    • April
    • March
  • 2023
    • May
    • April
  • 2022
    • November
    • October
    • August
    • February
  • 2021
    • November
    • July
    • June
    • May
    • April
    • March
    • February
  • 2020
    • December
    • November
    • September
    • August
    • June
    • May
    • April
    • March
    • January
  • 2019
    • December
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2018
    • December
    • November
    • October
    • September
    • August
    • June
    • May
    • April
    • March
    • February
    • January
  • 2017
    • December
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2016
    • December
    • November
    • October
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2015
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • January
  • 2014
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2013
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2012
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2011
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2010
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2009
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
Ευάγγελος.Μπαλάσκας.gr

License GNU FDL 1.3 - CC BY-SA 3.0