Skip to content

Instantly share code, notes, and snippets.

@Leksat
Created June 15, 2015 07:31
Show Gist options
  • Save Leksat/dbab07dce073b5872a30 to your computer and use it in GitHub Desktop.
Save Leksat/dbab07dce073b5872a30 to your computer and use it in GitHub Desktop.
sendmail
#!/usr/bin/php
<?php
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$t = '/Users/alex/outgoing_mails/' . date('Y-m-d_H-i-s') . '---' . $matches[1] . '---' . uniqid() . '.eml';
file_put_contents($t, $input);
chmod($t, 0666);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment