Skip to content

Instantly share code, notes, and snippets.

@voda
Created August 20, 2013 12:10
Show Gist options
  • Save voda/6280585 to your computer and use it in GitHub Desktop.
Save voda/6280585 to your computer and use it in GitHub Desktop.
fakemail for php to store emails to imap
#!/usr/bin/php
<?php
/**
* save as /opt/fakemail-imap.php
* set execute bit: chmod +x /opt/fakemail-imap.php
* add to php.ini: sendmail_path = /opt/fakemail-imap.php
*/
$params = array(
'mailbox' => '{localhost}INBOX', // see http://php.net/manual/en/function.imap-open.php
'user' => '',
'password' => '',
);
$message = file_get_contents("php://stdin");
$imap = imap_open($params['mailbox'], $params['user'], $params['password']);
imap_append($imap, $params['mailbox'], $message);
imap_close($imap);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment