How to Resurrect Procmail and Spamassassin on Dreamhost

How to Resurrect Procmail and Spamassassin on Dreamhost

Admittedly I have been very annoyed with Dreamhost since they announced that users would no longer be able to use procmail.

How to get procmail Back

After reading the most recent entry I realized that it is possible to still use both procmail and spamassassin.  However, this solution is not elegant.

Currently Dreamhost has a rudimentary Mail Filter system that is accessible by all mail users.  This system is due to be upgraded soon.  Dreamhost also allows regular shell users to access and run procmail as well as spamassassin.  In fact, shell users can install their own custom install of spamassassin.  Lastly, shell users can also receive email, although there is no imap or pop service for this mail.

 The Process

Using the above features it is possible to run a spamassassin setup that seems identical to the end user.  It works by forwarding your email all over the place.  First, your email is received by a mail account, this mail account has access to the rudimentary keyword filter.  The mail filter looks for an X-Scanned header to see if this email has already run through the procmail system.  Second, if the message has not been run through the procmail system it is forwarded to a user shell account.  Third, the user shell account receives the email and runs it through procmail and spamassassin.  During the process the procmail script adds the X-Scanned header, the procmail script can also add an X-Sort header if necessary.  Fourth, the last recipe in the procmail script forwards the email back to the mail account.  Finally, the mail account filters the email again, this time seeing the X-Scanned header and places it in your inbox.

The following is a flow chart that describes the process:

As noted, the setup requires a mail account and a shell account.  Also this scheme receives your email 3 times in order to accomplish the process:
1. The Mail Account receives incoming email
2. The Shell Account receives the mail forwarded from the Mail Account
3. The Mail Account receives the mail after it has be processed by the Shell account.

To me this seems to put more strain on the servers than was on them before using the old setup.  But if this is what they prefer than so be it.


This is obviously less than ideal, and will likely slow down the delivery of mail slightly, but in the end you will still be able to process email using spamassassin and procmail.

We still have to wait for Dreamhost to update the keyword filter.  Currently you would have to alter the subject or the body in order to process your mail.  As I said earlier, I would imagine that Dreamhost will update the filter very soon.


There is one upside to this system.  Using this method you could create a single shell account to handle all of your spamassassin work, including work for any user whether on your domain or not.  This would allow you to tweak global SA settings for all users.

This would be accomplished by setting procmail to forward the email back to which ever mail account sent it the email in the first place.  Theoretically you could filter and process any mail account this way, even accounts that are not hosted by dreamhost, as long as they can filter by message headers.  A feature that most cPanel accounts have accessible to them.

3 thoughts on “How to Resurrect Procmail and Spamassassin on Dreamhost

  1. Any luck yet? I’m not a unix expert, but I can follow tutorials pretty well. I’ve been trying to grok the instructions here:

    Just haven’t met any success yet. It looks, from the headers, as if dreamhost is scanning my mail for me, even after I disabled their “junk” filter. Procmail log shows that it’s being fed through my personal install of spamassassin, but the headers don’t show up on the other end…

    If you do get it set up and working, I’d be interested in details!

  2. Sorry I have not done anything with this yet.

    I have been waiting for Dreamhost to update the mail filtering like they promised. Right now you can only filter the basics, to, from, subject, body, and so on. I would like them to add a custom field which would enable you to filter based on custom headers such as KRK-Spam or something similar.

    I have SA running on my user account, and I was lucky enough to set this up before dreamhost changed the rules. But I am pretty sure even without testing this that what I have diagrammed above should work. It sounds like you are having more problems getting a spam filter running in general.

  3. Actually, I was lucky enough to set it up before they changed the rules, too… But the other day, in case you haven’t read the newsletter, they were looking for volunteers to move to new servers. I did *not* volunteer, but one day later found myself on the a new server, and my shell account and email account had been separated.

    They said they wouldn’t allow new accounts to have email access from the shell, and I thought I’d been grandfathered in, just like you. But without warning, I found my custom spamassassin install broken since I’d been moved to the new servers.

    They said they’d be moving folks over the course of the next year, so maybe I was just really unlucky to be one of the first accounts moved. But as a heads up, you’ve got at the most one more year before you’re moved, too… I hope they move everyone soon, so someone smarter than me can figure out how to get custom spamassassin installs working again. 🙂

    I think there are other glitches with the new mail server, because I never enabled their junk filter, but I’ve tried to disable it twice now, and I still find headers in my received emails to the contrary. I think that may be what’s preventing my custom spamassassin install from working. The “X-Spam-Status”, etc, headers are already there, so it’s refusing to re-scan. That’s my theory. Procmail log shows that the mail is being fed to my personal spamasassin install, and I’ve even managed to add a custom header with it… It’s just that I can’t get any output from my own SA install anymore.

Leave a Reply

Your email address will not be published. Required fields are marked *