I'm logging all php mail output using the mail.log setting in php.ini. Rather than log to a file I want to have the log data sent to a script for parsing in real-time to raise alerts.
I have tried:
mail.log="|/path/to/script.php"
in the hope that it might work like /etc/aliases, but that doesn't work. Any ideas greatly appreciated 🙂
System is Postfix on Debian.
Best Answer
One possible solution would be to use a wrapper for sendmail command, for example you can create a script like this:
and
php_set_envs.php
to sets some PHP variables to the shell environment:Now you force all customers to use this wrapper script instead of the original
/usr/sbin/sendmail
binary. Modify yourphp.ini
and add/change:Make sure it has correct access permissions:
I hope this help.