Skip to content

Instantly share code, notes, and snippets.

@jonavon
Forked from Caffe1neAdd1ct/trapmail
Created July 16, 2019 16:28
Show Gist options
  • Save jonavon/b514f4e0f2cd0e81fbcc8516abcca310 to your computer and use it in GitHub Desktop.
Save jonavon/b514f4e0f2cd0e81fbcc8516abcca310 to your computer and use it in GitHub Desktop.
Stop live emails going out via sendmail
#!/bin/bash
formail -R cc X-original-cc \
-R to X-original-to \
-R bcc X-original-bcc \
-f -A"To: new@email.com" \
| /usr/sbin/sendmail -t -i
# pipe all to a log instead, comment out formail code
#tee -a /tmp/trapmail.log > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment