Skip to content

Instantly share code, notes, and snippets.

@ebinnion
Created December 7, 2012 01:14
Show Gist options
  • Save ebinnion/4229923 to your computer and use it in GitHub Desktop.
Save ebinnion/4229923 to your computer and use it in GitHub Desktop.
Parse Imap emails
// 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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment