my use case: I want to find out if outgoing messages were delivered successfully, so I'm looking at the lines containing `status=` in the logfile.

But I need this only for some mails (not all). To find out, I have to query the database for the Queue-ID. This step could be skipped if it would be possible to prefix something like `foo.` to the Queue-ID.

(I know that there are other lines in the logfile with more details about the mail, but putting all those lines together is probably taking more time than the database query ;-)

Is it true that the Queue-ID is generated before Postfix receives the message content? After which SMTP command?


This is vague for me, so im going to make a leap in assumptions.

First did you turn on enable_long_queue_ids to give you better uniqueness since ID's will be important to you?

Then using omprog, first look for and match what conditions are important to you for these "some, but not all" emails. Like is it only emails going to or coming from x domain? Or contain a certain header which can be added to logging?

If you find this match knowing this email is going to be one you want to track then start a row in your database and add the queue_id to begin tracking this email.

Then when you get to the status log line check the database if that queue_ID exist, because it was flagged to track. If so update the DB with the status (sent, deferred, failed). If that queue_id isn't in the DB then you don't care about that status so disregard and carry on.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to