fetchmail + procmail + spamassassin setup help

Discussion in 'Installation/Configuration' started by thelorax, Jul 6, 2006.

  1. thelorax

    thelorax New Member

    First off, I know that bits and pieces of this have been covered elsewhere, but I'm apparently not smart enough to figure it all out, so please be patient.

    Here's what I would like to do: I have a catchall account that gets LOTS of spam (hundreds a day) but there are occasionally some important messages that I would like to get (and Thunderbird's filter just isn't cutting it). What I would like to do is retreive the messages from this account via fetchmail, and have procmail run them through spamassassin (or bogofilter, clamscan, whatever) and then place the messages in a local mailbox with good stuff in inbox and spam in a spam folder (or even just mark it as spam in the header so I can filter in the mail client).

    I have tried setting up .fetchmailrc and .procmailrc files but seem to be failing miserably

    .fetchmailrc
    Code:
    #set filter = /usr/bin/procmail -m $HOME/.procmailrc
    set daemon 180
    poll pop.server.com with proto POP3
        user ‘[username]’ there with password ‘[password]’ is ‘[me]’ here
    .procmailrc
    Code:
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin
    MAILDIR=$HOME/.maildir      #you'd better make sure it exists
    LOGFILE=$MAILDIR/from   #recommended
    
    # Use maildir-style mailbox in user's home directory
    DEFAULT=$HOME/.maildir/
    SHELL=/bin/sh
    
    :0fw
    | /usr/bin/spamassassin

    Any detailed advice in how to set this up would be greatly appreciated. I'm running Ubuntu 6.06 if it matters.

    Thanks
     
  2. freedog96150

    freedog96150 New Member

    I know that this is not a direct reply to your question, but I have an easier suggestion.

    Why not figure out the exact accounts that are used for the "important" emails, create those email boxes and set your catchall to /dev/null.

    My experiences are that the catchall will always be OVERLOADED with spam because all the spambot has to do is sub in [email protected] and ALL that spam is guaranteed to get delivered. At least with explicit email box addresses, the spam has to be addressed to an existing user, anything else gets dumped.

    As far as sifting through the morass of emails left, I use the following combo of packages:
    MailScanner+ClamAV+Spamassassin+DCC+Vipul's Razor

    I found the installation of these packages to be very straighforward and had everything installed in running with an evenings worth of tweaking. Start with MailScanenr as they have an optional file at http://www.mailscanner.info/downloads.html in the "other downloads" section that will install ClamAV and Spamassassin in one shot all preconfigured for MailScanner. Make sure that you also read the appropriate sections on the MailScanner documentation that refer to your specific MTA [i.e., Postfix, Exim, sendmail, Procmail, etc]. After that, DCC and Razor are just simple installs with minimal configuration to get them working with MailScanner and Spamassassin.

    Without starting any wars (no flames please), I go this route versus the procmail filter route because I found that I could not stay on top of all the rules that I needed to create to block all the *new* ways that spammers find to flood your inbox every day. With the above tools, much of that is done for you and updated automatically....less work for me :)

    Hope some of that helps!
    Brian
     
  3. falko

    falko Super Moderator Howtoforge Staff

    You must pipe the emails from fetchmail to Postfix which then delivers the mails to the appropriate mailboxes. And in the users' homedirs you can then use procmail to scan the emails.
     

Share This Page