Hello list, my apologies in advance for the almost OT question. I need to setup a mail server that does a particular thing: it receives mail (from user SMTP submission, not as final destination) and, instead of relay, "does something" that ends up in having the mail (body + headers + attachments) in a mysql table. The ideal thing would be some mta that keeps the mail spool directly on a database backend; knowing that this is generally unwanted because of performance and reliability issues (and thus, rightfully, never implemented, specially in Postfix), I'm trying to figure out a way to get the same result. Note: strict realtime is NOT a requirement (I'm allowed to do some sort of processing between mail arriving and its insertion in the database). After a couple of days of brainstorming, I came to a conclusion that relies on Postfix and on some coding: using the after-queue filtering capabilities of Postfix, I would first dump the mail (flat file) in a directory (with a slightly modified version of this bash script: http://www.postfix.org/FILTER_README.html#simple_filter); then, using a cronjob scheduled every, let's say, 5 minutes, invoke some (php? ruby? perl?) script that does the batch import task "out of band" and removes the dump file. I think that this "decouple" thing should give robustness to the whole process, providing small and single-task scripts for dump and import phases; it should be the "unix way" of doing things right :)
How would you accomplish the task? Can you think of some better solution? Please correct me if I'm wrong in something. Thank you! Fabio