Last active
September 4, 2017 09:04
-
-
Save moritzjacobs/d31bba28939a9fc7982c to your computer and use it in GitHub Desktop.
phpmaillog v3
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/php | |
<?php | |
/* | |
# phpmaillog | |
Save emails to your desktop instead of sending them in local dev environments | |
## Installation: | |
### For Mac OS X: | |
- save to `/usr/local/bin/phpmaillog` (no `.php` extension needed) | |
- `chmod +x /usr/local/bin/phpmaillog` | |
- edit your `php.ini`: | |
`sendmail_path = /usr/local/bin/phpmaillog` | |
- Test in console: | |
`echo "Subject: Test\nFrom:[email protected]\n\nWorks like a charm" | phpmaillog` | |
You should now find a `<Timestamp>-<ID>.eml` file on your Desktop (use quicklook to view) | |
### Other OS | |
… | |
*/ | |
$now = @date('YmdHis') + 0; | |
$email_file = '/Users/'.get_current_user().'/Desktop/'.$now.'-'.uniqid().'.eml'; | |
$email_content = ''; | |
$pointer = fopen('php://stdin', 'r'); | |
while ($line = fgets($pointer)) { | |
$email_content .= $line; | |
} | |
file_put_contents($email_file, $email_content); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
phpmaillog
Save emails to your desktop instead of sending them in local dev environments
Installation:
For Mac OS X:
/usr/local/bin/phpmaillog
(no.php
extension needed)chmod +x /usr/local/bin/phpmaillog
php.ini
:sendmail_path = /usr/local/bin/phpmaillog
echo "Subject: Test\nFrom:[email protected]\n\nWorks like a charm" | phpmaillog
You should now find a
<Timestamp>-<ID>.eml
file on your Desktop (use quicklook to view)Other OS
…