How can I log all emails going through sSMTP?
I can point my applications to a wrapper script, I just don't know how to write a wrapper script which logs headers and contents to a file (as much information as possible).
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
The following should work as an sSMTP wrapper script. It logs the parameters it is called with and the data provided on stdin. Change the logfile location and name of the real sSMTP as appropriate.
#!/bin/sh set -e LOGFILE="/tmp/ssmtp-$(date +%Y%m%d-%H%M%S-$$)" echo "$0 $@" > "$LOGFILE" tee -a "$LOGFILE" | ssmtp.real "$@"
Remember to make the script executable:
chmod +x /path/to/script