SpamAssassin, fetchmail, postfix

I installed spamassassin and now I want to have mail from an account run through spamassassin and have the mail show spamassassin’s rating.

I have done this with procmail/sendmail, but not with postfix/fetchmail.

Is fetchmail the same as procmail?

Do the recipes work the same?

Any advice for a fetchmail script to pipe mail through spamassassin and then include the spaminess rating in the resulting mail?

No, procmail and fetchmail are different animals.

Fetchmail is a mail user agent that logs in to your desired POP3, IMAP etc accounts and grabs the mail. It then hands it to the local SMTP server or delivers it directly. There are many other modes of operation, but basically it’s an automatic mail fetcher, as the name suggests.

Procmail is a mail filter that makes decisions on what to do with mail based on header lines and auxiliary programs. It’s a mail refiler, bouncer, etc. It doesn’t talk any mail protocols but expects input on stdin.

Normally you would use something like amavis to handle the filtering of mail going through postfix. This is a program that manages spam and virus filters to work on emails sent through it, spamassassin being one such filter.

For an example of how amavis is setup, have a look at this tutorial. It’s for Debian, but you can see the overall architecture.

Howto: ISP-style Email Server with Debian-Etch and Postfix 2.3

Amavis is in the OpenSUSE repos, and is packaged in a way ready for use as explained above, you just have to edit its config file to suit.

This looks quite good.

I wonder though if I can also install procmail and use spamassassin as I’m used to just for the sake of time.

If I install procmail, is there anything else I have to do to make it work with postfix?

Procmail will work as a system-wide filter or as a personal filter from a .forward file.

So if I had a mailbox called spam1 would I then forward to procmail which would read my .procmailrc file and then it would forward back to the *spam1 *mailbox?

Depends on how you have set it up, as I already said, whether procmail is invoked for all incoming mail or enabled by each user in .forward. You’d have to read the postfix docs.