Filter on all mail to domain?


#1

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 foo.com, and i receive an email addressed to "emailaddresstest1@foo.com", i want to test for “test1” and pass that email to some mailbox "test1@foo.com". And if i get "emailaddresstest2@foo.com", i want to put that in "test2@foo.com".

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?

thanks,
–derek


#2

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

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


#3

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?

thanks,
–derek


#4

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 "itest1-1@foo.com", "itest1-2@foo.com", etcetera, with each mailbox forwarding a copy to "itest-all@foo.com" - this of course presumes that all email mailboxes on the “foo.com” domain are hosted on Dreamhost and not forwarded elsewhere.

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


#5

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 “foo.com” 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?

thanks,
–derek


#6

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.