Log all mails and content (sSMTP)

sSMTP has debug logging built in. In your ssmtp.conf file, include the following line: Debug=YES

When debug logging is active, the entire contents of emails sent via sSMTP, including headers, is logged to syslog.


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


My working solution is: ssmtp -d9 <email-recipient>.