Created
August 17, 2011 15:06
-
-
Save marceloandrader/1151721 to your computer and use it in GitHub Desktop.
Replace sendmail script for avoid sending mails to real people on dev
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
#!/usr/local/bin/php | |
<?php | |
$email = file_get_contents('php://stdin'); | |
$email = preg_replace('/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/', '<email_you_want_to_redirect>', $email); | |
//var_dump($email); | |
//exit; | |
$fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail"); | |
fputs($fd, $email); | |
pclose($fd); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment