Created
June 23, 2009 19:47
-
-
Save ramsey/134784 to your computer and use it in GitHub Desktop.
Script to redirect mail in a staging environment
This file contains 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/sh | |
################################################################################ | |
# Script to redirect mail in a staging environment | |
# | |
# Set this script to executable (chmod 755), and modify php.ini in the staging | |
# environment to use this script instead of sendmail: | |
# | |
# sendmail_path = /path/to/trapmail.sh | |
# | |
################################################################################ | |
perl -pe 's/subject: ([^ ]*)/Subject: [Staging] \1/i' \ | |
| formail -f \ | |
-R cc X-Original-Cc \ | |
-R to X-Original-To \ | |
-R bcc X-Original-Bcc \ | |
-A"To: <user1@example.org>, <user2@example.org>" \ | |
| /usr/sbin/sendmail -t -i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just what i was looking for, thanks!