Last active
November 7, 2017 10:54
-
-
Save magnetikonline/6059512 to your computer and use it in GitHub Desktop.
Bash script to write/sink output sent to sendmail to a log file. Useful for debugging with PHP and other runtimes that talk to sendmail.
This file contains hidden or 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/bash -e | |
# For PHP5 and /etc/php5/php.ini you would setup like so: | |
# sendmail_path = "/path/to/sendmailsink.sh" | |
LOG_FILE="/var/log/sendmailsink" | |
echo "$(date "+%Y-%m-%d @ %H:%M:%S") || $0 $*" >>$LOG_FILE | |
echo >>$LOG_FILE | |
while read buffer | |
do | |
echo "$buffer" >>$LOG_FILE | |
done | |
echo "=================================" >>$LOG_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment