Created
August 19, 2014 08:56
-
-
Save matteomattei/33f51bdcd68519414a60 to your computer and use it in GitHub Desktop.
How to log email sent from PHP through mail() function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
putenv("HTTP_HOST=".@$_SERVER["HTTP_HOST"]); | |
putenv("SCRIPT_NAME=".@$_SERVER["SCRIPT_NAME"]); | |
putenv("SCRIPT_FILENAME=".@$_SERVER["SCRIPT_FILENAME"]); | |
putenv("DOCUMENT_ROOT=".@$_SERVER["DOCUMENT_ROOT"]); | |
putenv("REMOTE_ADDR=".@$_SERVER["REMOTE_ADDR"]); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
logger -p mail.info sendmail-wrapper.sh: \ | |
site=${HTTP_HOST}, \ | |
client=${REMOTE_ADDR}, \ | |
script=${SCRIPT_NAME}, \ | |
pwd=${PWD}, \ | |
uid=${UID}, \ | |
user=$(whoami) | |
/usr/sbin/sendmail -t -i $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment