Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Mail2Disk XAMPP utility for native sendmail function
- *
- * In php.ini set following:
- * sendmail_path="C:\xampp\php\php.exe C:\xampp\mailtodisk\mailtodisk.php"
- * (path to php executable) (path to this script)
- *
- */
- // Absolute path to folder we would like to store our emails in
- const MAIL_DIR = 'C:\\XAMPP\\mailtodisk\\';
- // File extension of recieved email message
- const MAIL_EXT = '.eml';
- $input = file_get_contents('php://stdin');
- $filename = MAIL_DIR . 'mail-' . gmdate('Ymd-Hi-s') . MAIL_EXT;
- $retry = 0;
- while(is_file($filename))
- {
- $filename = MAIL_DIR . 'mail-' . gmdate('Ymd-Hi-s') . '-' . ++$retry . MAIL_EXT;
- }
- file_put_contents($filename, $input);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment