Skip to content

Instantly share code, notes, and snippets.

@marceloandrader
Created August 17, 2011 15:06
Show Gist options
  • Save marceloandrader/1151721 to your computer and use it in GitHub Desktop.
Save marceloandrader/1151721 to your computer and use it in GitHub Desktop.
Replace sendmail script for avoid sending mails to real people on dev
#!/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