1

I am writing an application which will parse MTA responses and update a database indicating if the message was successfully delivered (dns: 200), or an error occurred (dsn: 511). As I am not a systems guru I decided to ask here, after some toying around to see which approach would be best to solve my problem.

I followed this guide, first, and which I had the most success with, as I was able to parse the message via my script. However the content was the message before it was sent to the remote mail server. So then I read this post; which explains how to use transport_maps. And as if there weren't enough options, there was this post about how to use an alias, instead.

Which of these solutions would be best? Again, I would like to track ALL responses, not just bounce responses.

Mike Purcell
  • 1,758

2 Answers2

1

Neither. You want to know what the server did with a message, you should read the log.

By default postfix logs to the syslog facility MAIL. Generally, by default, that will write the messages to /var/log/maillog or /var/log/mail.log.

Given that rsyslog and syslog-ng can both write to SQL databases, you might want to just to do that and write some appropriate queries.

84104
  • 13,181
  • 6
  • 49
  • 80
0

Bounce messages may be generated not only by your MTA (postfix) but also by "next hop" email servers. Do not expect to parse all bounces using simple script.

You may use yourname+bounces@yourdomain.com as envelope sender address and use separate ~/.forward file to redirect bounces (messages to e yourname+bounces) as descibed at Postfix VERP HOWTO

BTW:

1 Do not forget about temporary delivery problems (DSN: 400).

2 I would suggest using VERP based solution to track bounces (per message/recipient bounce address).

AnFi
  • 6,326