-
-
Save ivanhoe011/3e08f75fa7a9d8c385b788376733880b to your computer and use it in GitHub Desktop.
Script to open sent mail in Apple Mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
# Save this script somewhere and set you sendmail path in php.ini like this: | |
# sendmail_path = sudo -u <your_system_username> <path_to_script>/mail.php | |
# create a filename for the emlx file | |
list($ms, $time) = explode(' ', microtime()); | |
$filename = dirname(__FILE__).'/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx'; | |
# 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 emlx file (using Apple Mail) | |
exec('open '.escapeshellarg($filename)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment