I'm trying to add incoming email to my web application. It's built on CodeIgniter and PHP, and as far as I can tell I haven't found any CI libraries to do this.
What I'd like to do is have a controller that connects to my mail box, via POP3 or IMAP, and retrieves the message, parses it then removes it from the server.
Piping mail from postfix/etc isn't going to work on my server setup.
Any suggestions would be immensely helpful.
Thanks!
http://ca.php.net/imap
$mb = imap_open("{host:port/imap}","username", "password" );
$messageCount = imap_num_msg($mb);
for( $MID = 1; $MID <= $messageCount; $MID++ )
{
$EmailHeaders = imap_headerinfo( $mb, $MID );
$Body = imap_fetchbody( $mb, $MID, 1 );
doSomething( $EmailHeaders, $Body );
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With