|Main Archive Page > Month Archives > postfix-users archives|
> 2011/11/25 Ralf Hildebrandt <Ralf.Hildebrandt@charite.de>:
> > * Vincenzo Romano <firstname.lastname@example.org>:
> >> Hi all.
> >> My application uses the sendmail interface of its local postfix
> >> installation to send emails, a few thousand a day.
> >> Of course, this has been working pretty fine so far.
> >> Now I'd need to be able to track these emails and the best thing I
> >> could do is to "somehow" obtain from sendmail/postfix
> >> the message-ID it generated to each single submission so I can later
> >> check the logs about delays and so on.
> >> I've not been able to find a reliable way to do it as my issue is that
> >> I can send several emails to the same destination address within a few
> >> seconds and simply use the destination address and the (supposed)
> >> submission timestamp won't help much.
> >> Any idea whether this is doable and how to?
> > Rather use SMTP injection and then use the queueid:
> > MAIL FROM:<email@example.com>
> > 250 2.1.0 Ok
> > RCPT TO:<firstname.lastname@example.org>
> > 250 2.1.5 Ok
> > DATA
> > 354 End data with <CR><LF>.<CR><LF>
> > foo
> > .
> > 250 2.0.0 Ok: queued as 3Sqgph2ghTz2r0b <-------- !
> > QUIT
> Yes, that's the SMTP dialogue.
> But it seems to me that the sendmail (or any other postfix tool) can
> provide it to be on a per-submission basis ...
The Postfix sendmail command creates a temporary queue file that
is deleted as soon as the local mail pickup daemon has read the
file. So, that queue file ID is useless.
You can specify your own envelope ID on the Postfix sendmail command
line. This will be returned in delivery status notifications (as
long as the remote MTA implements the DSN RFCs).
Postfix does not log the DSN envelope ID information, but code for
that could be added to the cleanup daemon.
There is also RFC 3885 which builds a tracking mechanism on top of
the aforementioned DSN envelope ID information. But this is of limited
interest, since qmail, exim and some other MTAs don't implement DSN.