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,688
  • 7
  • 30
  • 53

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
  • 12,698
  • 6
  • 43
  • 75
  • Why neither? Does parsing the mail log provide more data than handling a remote mta response? Ya nothing in syslog, but there are entries in /var/log/maillog. – Mike Purcell Jun 21 '13 at 03:26
  • Thanks for the response, I am working on configuring rsyslog to parse the messages and drop the data directly into a mysql table. This avoids having to write a separate script to parse the log file, or writing a script to handle return responses. – Mike Purcell Jun 28 '13 at 00:12
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
  • 5,883
  • 1
  • 12
  • 26