Skip to content

Instantly share code, notes, and snippets.

@schmkr
Last active December 11, 2015 17:28
Show Gist options
  • Save schmkr/4634605 to your computer and use it in GitHub Desktop.
Save schmkr/4634605 to your computer and use it in GitHub Desktop.
Script to catch mails on development machines
#!/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));
@maximuff13
Copy link

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