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

后端 未结 2 1120
别那么骄傲
别那么骄傲 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:10

    For a more independent approach you could build a Third party plugin with Zend framework (https://docs.zendframework.com/zend-mail/read/). I have used their ACL modules within Codeigniter and is a good way of getting the best of both frameworks.

    This also allows you to parse the emails and extract attachments etc.

    0 讨论(0)
  • 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 );
    }
    
    0 讨论(0)
提交回复
热议问题