Skip to content

Instantly share code, notes, and snippets.

@zobzn
Created March 21, 2020 15:21
Show Gist options
  • Save zobzn/bcd11126f2b6c0d03a0653b8d4c89f72 to your computer and use it in GitHub Desktop.
Save zobzn/bcd11126f2b6c0d03a0653b8d4c89f72 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
// ini_set('sendmail_path', '/var/www/sendmail.php -t');
$filedata = file_get_contents('php://stdin');
$filename = realpath(dirname(__FILE__) . '/../data') . '/mail/' . date('Y-m-d-H-i-s') . '-' . md5($filedata) . '.eml';
if (!is_dir(dirname($filename)))
{
@mkdir(dirname($filename), 0777, true);
}
if (is_dir(dirname($filename)) && is_writable(dirname($filename)))
{
@file_put_contents($filename, $filedata);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment