[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: postfix "delivery-date" - how to?



On Tue, Apr 24, 2018 at 08:38:39PM +0200, Kamil Jońca wrote:
> 
> Exim has a nice feature: it puts "Delivery-date" header when terminates
> delivery to pipe/mailbox.
> 
> Is it posible with postfix?

It is possible, not necessarily convenient.

Here's how Postfix delivers mail:

http://www.postfix.org/OVERVIEW.html#delivering

See the items on the far right side? Those are transports,
which are configured in master.cf

You can see that local(8) is generally responsible for
writing messages to local users in their
mailbox/maildir/whatever.

You need to insert your timestamp header at that stage.

If you deliver to mailbox, you almost get that for free:

   In the case of UNIX-style mailbox delivery, the local(8) daemon
   prepends a "From sender time_stamp" envelope header to each message,


but I think you want in-message headers. So you need a filter
that can insert one cleanly. 

In Debian's maildrop package, there is a nice filter called
formail. You can use some shell scripting to rig up a local
delivery alternative that postfix calls in master.cf, adds
a header with formail, and then writes to your output file
format of choice.

I'm not sure why you want to do all this, though, because the
standard set of Received: headers should give you a series of
timestamps that show the time it took for the message to make
its way across the Internet and to your mail server, Once it's
on your mail server, delivery should happen within a second or
two, maybe 3 for a very heavily loaded system.

And if you only want this for one or a few users, you could
insert your formail manipulation in their ~/.forward files
instead.

-dsr-


Reply to: