Quote:
Originally Posted by sakmr
Hello,
We have built an application to send emails using our Postfix MTA and want to track the delivery of those emails from application itself.
Application and Postfix are deployed on two different servers. Application on Windows/PHP and Postfix on CentOS.
App is web based and creating its own log files having mail ID number for each email sent to Postfix and Postfix generates its own mail ID (session ID) for those emails while sending it out for destination MTAs.
It is creating confusion and we are unable to track exact email delivery status using our Application.
Please suggest if there is any way we can push Application's mail ID numbers also to postfix logs along with other header detail so that we can track it till final delivery.
|
Maybe, but since you're using Windows, good luck. It's been a LONG time since I've touched Windows, but getting a syslog agent on Windows used to entail $$$ and time. And, it wasn't stable. And you also don't say ANYTHING about your application, then environment you're in, or anything about the Linux system. Basic steps:
- Modify your application to either send standard syslog events with the type "LOG_MAIL", or have it send those messages to a Windows syslog agent.
- Configure your Linux system to listen for syslog events from the Windows system
- Log those events into your existing mail log.
Either way, your application is going to have to be modified, and even then it may not work as you want. Your systems will have to be time-sync'ed, and the application may fire off an email, and it may be queued for xxx time until Postfix shovels it out....leading to a disjointed log file, that's going to be hard to track. With a custom application and a postfix linux server, if you're trying to track things accurately, I'd consider shoving it all into a database. Plenty of tutorials on how to get syslog events into a MySQL database, and since you wrote your own app for mail, you have the ability to make it do whatever you want. Shove in a unique ID number for your messages, which will go into the database. You can then look up that number, which may (?) be part of the postfix log message, or at least be tied to a user ID/address, which you can then look up.