Wednesday, September 5, 2012

Find Which PHP Application is sending mail from Linux Box

Add the follwing line in php.ini

sendmail_path = /usr/local/bin/sendmail-php -t -i

Create a shell script file in /usr/local/bin/sendmail-php and paste the following code in this file


#!/bin/sh

logger -p mail.info sendmail-php: site=${HTTP_HOST}, client=${REMOTE_ADDR}, script=${SCRIPT_NAME}, filename=${SCRIPT_FILENAME}, docroot=${DOCUMENT_ROOT}, pwd=${PWD}, uid=${UID}, user=$(whoami)

/usr/sbin/sendmail -t -i $*

restart the apache server

and view the apache error log using

#tail -f /var/log/httpd/error_log 


No comments:

Post a Comment