PHP: Download incoming email from POP3 or IMAP, parse it, and mark it as read/delete on server

后端 未结 2 1121
别那么骄傲
别那么骄傲 2021-01-31 12:41

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

2条回答
  •  醉话见心
    2021-01-31 13:15

    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 );
    }
    

提交回复
热议问题