tags:

views:

42

answers:

1

I'm trying to set up a mechanism whereby files can be mailed to addresses at a domain, to be processed by a script etc etc. There'll be a postfix server listening for mail to the domain (in postfix terms, I think it's a "virtual domain"), it'll use a PostgreSQL lookup to distinguish real from bogus recipients, and then it should hand off the mail body to a script that'll do various things.

I think that I understand how to get the server to listen for mail for a domain, and I'm pretty sure I've got the PostgreSQL configuration right (and I can test it with postmap and it seems to work). What's really confusing me however is how to get the transport mechanism set up. I think that what I need to do is define something via the "pipe" service in "master.cf", but the vastness of postfix and the myriad things it can do over and above the 1 simple thing I happen to want it to do are daunting impediments.

Is there some sort of easy-to-digest howto somewhere for this? There are all sorts of fascinating how-to articles for postfix, but so far the ones I've found are all about weird esoteric mail server challenges and not about the (probably dirt-simple) thing I need to do.

A: 

For what it's worth here's what I think is necessary for a basic, not necessarily secure, setup:

  • create a "transport" in "master.cf" that uses "pipe" to hook up to the program/script of your own design. Your script will be passed the mail messages as standard input, and can be configured (in master.cf) with all sorts of useful arguments - see the postfix "pipe" command documentation
  • create a virtual domain for your virtual mailboxes. Don't use "virtual-alias-foo", use "virtual-mailbox-foo".
  • if you're looking up addresses in a PostgreSQL database like me, add a .cf file for the database lookups. This part is pretty easy really; you just need to write a query that'll return when it finds a good address. One thing I don't entirely know for sure is what the script should return - I have mine return the original destination address when it finds a good one.

That's about it I think ...

Pointy

related questions