Skip to content

Instantly share code, notes, and snippets.

@mymizan
Created September 18, 2015 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mymizan/4d481fd01d4b10915cff to your computer and use it in GitHub Desktop.
Save mymizan/4d481fd01d4b10915cff to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
# create a filename for the emlx file
list($ms, $time) = explode(' ', microtime());
//$filename = '/tmp/testmail/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx';
$filename = '/tmp/dummymail.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_APPEND);
file_put_contents($filename, $email_contents, FILE_APPEND);
file_put_contents($filename, $fstat['size']." ---- END --- \n \n", FILE_APPEND);
# open up the emlx file (using Apple Mail)
//disable opening mail client
//exec('open '.escapeshellarg($filename));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment