Filter on all mail to domain?

I want to set up filters on all incoming mail to my domain so that i can test for a certain string and redirect to specific mailboxes.

So for example, if my domain is, and i receive an email addressed to "", i want to test for “test1” and pass that email to some mailbox "". And if i get "", i want to put that in "".

The way i read the add filter page, i can add a filter to a mailbox, but not to the domain itself. How can i pre-process incoming mail before it gets passed to mailboxes?


You can do that with aliased addresses, ie. email addressed to "" auto-forwards to “test1”; this does more-or-less “pre-process”, and you can either make it forwarding-only (in which case the "" address doesn’t actually exist except to forward to "") or you can set it up in a cc: arrangement (where a mailbox for "" is present and forwards a copy to "".

Getting more complicated than that will probably require a setup of Procmail or similar program.

thanks for the quick reply!

the problem is that i use this domain partially as a test for a software package, where i will send n-number of emails to a domain, and need to verify that all were received… but i cannot setup individual receipt handlers like forwarders.

It was much easier before i had to stop using a catch-all address. what’s procmail or rather, since i can google it, what’s the dreamhost solution?


I’m sorry - “receipt handlers”…? Ya lost me on that one.
As far as “all received” to a whole domain, set-up a buncha test mailboxes and have each one as “forward a copy” to single mailbox that might otherwise be labeled as a “catch-all”. Therefore you would set-up individual mailboxes for "", "", etcetera, with each mailbox forwarding a copy to "" - this of course presumes that all email mailboxes on the “” domain are hosted on Dreamhost and not forwarded elsewhere.

Other than that, I’m not quite sure whatchyer askin’ for here.

Setting up a bunch of test mailboxes is not an option; i test an application that requires unique email addresses for users. A typical test involves uploading tens of thousands of test users.

Now, if i’m running email launch tests, i uses email addresses that ultimately send the mail to dev/null on our own internal system. But if i need to test a user-interaction with our application, i need a box that will actually receive system-generated emails (and be external to my own system, hence a dreamhost-ed site), and i need fresh email addresses because i need fresh test users.

So the very best solution for me is a catch-all mailbox for my test domain “” such that every email sent to that domain goes into one bucket, so i can use a pop reader to quickly count recieved emails and to read as needed.

I can’t do that because of freakin’ spam.

So the next best thing is a mechanism that allows me to 1.) verify that incoming mail is valid and b.) put that email into a single bucket. Now, the complexifying factor here is that i have several testers, so i need to use several buckets based on the tester, because i want the test mail kept seperate.

It looks like procmail is the solution, since it supports regexing on the address. thanks for that suggestion.

So my questions now are:
a. will this work with filtering; apparently i can’t use the admin UI to add filters, but i should be able to hook up spamassassin via procmail, right?
b. with the scenario i have described, does it make more sense to apply spamassassin before or after i run my bucket-izing calls?


You probably don’t need spamassassin. It doesn’t sound as if the domain is used for “real” email, so you can probably just discard anything that’s not part of your test (eg, if the recipient doesn’t match one of your test users).

The Dreamhost admin UI can add simple types of procmail filters, but probably not the kind you need. So you should create a shell account and edit the .procmailrc by hand.