Skip to content

Instantly share code, notes, and snippets.

@AntonTyutin
Last active June 9, 2022 11:37
Show Gist options
  • Save AntonTyutin/8254685 to your computer and use it in GitHub Desktop.
Save AntonTyutin/8254685 to your computer and use it in GitHub Desktop.
A stub of "sendmail" command. Appends mail to file instead of send it to mail server. Depends on Perl and its "MIME::QuotedPrint" module.
#!/bin/bash
MAIL_LOG=${LOG_DIR:-/var/log}/mails.log
echo '== [' $(date +%Y-%m-%d_%H-%M-%S) '] ==' >> $MAIL_LOG
perl -MMIME::QuotedPrint -pe '$_=MIME::QuotedPrint::decode($_);' | tee -a $MAIL_LOG > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment