From: "Stephens, Kurt" on
I'd like to have all local postfix deliveries to go directly into a TCP or UDS (named pipe) socket,
that will eventually end up raw in database table for subsequent triage.

Are there any concrete examples or tools that do not include procmail?

It appears that local(8) expects the mailbox path to be either a maildir dir/ or a plain old mbox file (due to the exclusive lock and truncation on error).
Has anyone tried pointing local(8) directly at a named pipe?
Use netcat via pipe(8)?
I want to completely avoid procmail.

Thanks,
Kurt Stephens

From: Martin Adolfsson on
On 2010-03-26 05:32, Stephens, Kurt wrote:
> I'd like to have all local postfix deliveries to
> go directly into a TCP or UDS (named pipe) socket,

I wrote a small hack for this a few years back, and it has been in
production for a few of our customers ever since. (I believe it's fairly
portable and should compile on most platforms)

You can download it from: http://netilium.org/~mad/sockpipe.c

Its been designed to exit with EX_TEMPFAIL if it can't connect to the
server, or if the server closes while the program is sending data. That
way, Postfix will retry later.

Since there is no protocol involved, Postfix has no way of knowing if
the delivery actually succeeded - you need to make sure that the
receiving program is able to handle the e-mail if it accepts the connection.

Simply put the compiled program as a transport into master.cf, using the
pipe cmd:
---------------------------------------------------------------------
sockdeliv unix - n n - 1 pipe
flags=R eol=\r\n user=nobody argv=/../sockpipe <IP> <PORT>
---------------------------------------------------------------------

Then use something in the lines of "mailbox_transport = sockdeliv" in
main.cf.


Regards,
Martin Adolfsson

From: Wietse Venema on
Stephens, Kurt:
> I'd like to have all local postfix deliveries to go directly into
> a TCP or UDS (named pipe) socket, that will eventually end up raw
> in database table for subsequent triage.

It's easy enough to take one of the pipe(8) examples in master.cf,
run a netcat-like command, and set main.cf:local_transport
appropriately.

It's even easier to run such a command from the user's .forward
files.

But you cannot use the To: header address. Proof: you received this
email message, but you are not listed in the message header.

You MUST pass the envelope recipient information (and perhaps sender
for auto-replies) to your database, otherwise you will mis-deliver
list mail, and other BCC recipients.

Wietse