Skip to content

Instantly share code, notes, and snippets.

Created June 18, 2013 09:13
Show Gist options
  • Save anonymous/5803875 to your computer and use it in GitHub Desktop.
Save anonymous/5803875 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
$processUser = posix_getpwuid(posix_geteuid());
$name = $processUser['dir'].'/mail/'.date('Y-m-d H:i:s').'-'.microtime(true).'.eml';
if (!is_dir($dir = dirname($name))) {
mkdir($dir, 0777, true);
}
$fh = fopen($name, "w");
if (!$fh) {
die(1);
}
while ($buf = fread(STDIN, 8192)) {
fwrite($fh, $buf);
}
fclose($fh);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment