Discussion:
Tracking Activity
(too old to reply)
d***@dsny.com
2018-10-16 20:52:22 UTC
Permalink
I am looking for a way to track the activity of a single email address including server send attempts, successes, bounces. I expect to have the from address something like reply+***@domain where the token tells me more about the send. My plan is to write any needed script in Python where possible.

What I don't know is how to configure Postfix so I can
1) record a successful send
2) record a failed send attempt that was deferred till later, including the cause if known
3) record a bounced message, including the cause if known

There are plenty of bits of knowledge out there, but my searching has not yet led me to how to do this. It does seem there would be two solutions required for this, one for successes and one for bounces, but I am not yet certain on that either.

Any starting help would be greatly appreciated.
Jonathan N. Little
2018-10-16 21:16:52 UTC
Permalink
Post by d***@dsny.com
What I don't know is how to configure Postfix so I can
1) record a successful send
2) record a failed send attempt that was deferred till later, including the cause if known
3) record a bounced message, including the cause if known
There are plenty of bits of knowledge out there, but my searching has not yet led me to how to do this. It does seem there would be two solutions required for this, one for successes and one for bounces, but I am not yet certain on that either.
Any starting help would be greatly appreciated.
I just use pflogsumm

<https://www.google.com/search?q=pflogsumm>
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
d***@dsny.com
2018-10-16 21:33:29 UTC
Permalink
Post by Jonathan N. Little
I just use pflogsumm
That looks great Jonathan, thank you.

I should have added the results need to be inserted to a database where they can be queried by the token.
Jonathan N. Little
2018-10-16 21:55:06 UTC
Permalink
Post by d***@dsny.com
Post by Jonathan N. Little
I just use pflogsumm
That looks great Jonathan, thank you.
I should have added the results need to be inserted to a database where they can be queried by the token.
<https://linux.die.net/man/1/pflogsumm>

I use shell script with cron jobs to create hourly updated data for
today's stats and daily one for yesterdays summary then a php page to
display the reports in my web "control panel". You can certainly use
bash, perl, php, python, or language of choice to parse and extract
whatever data points you wish and insert into a database.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
d***@dsny.com
2018-10-17 19:10:21 UTC
Permalink
Post by d***@dsny.com
What I don't know is how to configure Postfix so I can
1) record a successful send
2) record a failed send attempt that was deferred till later, including the cause if known
3) record a bounced message, including the cause if known
There are plenty of bits of knowledge out there, but my searching has not yet led me to how to do this. It does seem there would be two solutions required for this, one for successes and one for bounces, but I am not yet certain on that either.
Any starting help would be greatly appreciated.
I am trying not to scan log files for this, preferring to be scripts embedded in the pipeline.

I figured out how to script capture all bounces for a single address using transport and VERP like from addressing. That works very well with minimal code and even captures reply messages for processing.
1. create a transport file ".etc/postfix/transport" with the following content
***@mydomain.com myfunc:
2. run "postmap /etc/postfix/transport" to build the binary file.
3. add "transport_maps = hash:/etc/postfix/transport" to main.cf
4. add the following to master.cf with any of the $ params needed
myfunc unix - n n - - pipe
flags=R user=some_user argv=/your_script.py ${extension} ${recipient} ${domain} ${sender} ${size} ${user}
5. run "postfix reload"
6. send an email with the from as "myemail+***@domain.com" and set the TO to a bad address so it will bounce.

What I am now trying to figure out is how to capture successful sends by injecting a script in the pipeline. Anyone know where or how to do that?
Continue reading on narkive:
Loading...