Last active
December 11, 2015 17:28
-
-
Save schmkr/4634605 to your computer and use it in GitHub Desktop.
Script to catch mails on development machines
This file contains hidden or 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/bin/env php | |
<?php | |
# create a filename for this email | |
list($ms, $time) = explode(' ', microtime()); | |
$filename = '/tmp/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.txt'; | |
# write the email contents to the file | |
$email_contents = fopen('php://stdin', 'r'); | |
$fstat = fstat($email_contents); | |
file_put_contents($filename, $fstat['size']."\n"); | |
file_put_contents($filename, $email_contents, FILE_APPEND); | |
# open up the txt file (using Apple Mail) | |
exec('open -a "/Applications/Google Chrome.app" '.escapeshellarg($filename)); |
is there a trick to get it run with OS X 10.10 and XAMPP 1.8.3-5 ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And only need to change this in
php.ini
Or wherever the script is stored.
And don't forget to put the executable flag on the file