php imap - get body and make plain text

后端 未结 6 1905
故里飘歌
故里飘歌 2020-12-30 02:18

I am using the PHP imap function to get emails from a POP3 mailbox and insert the data into a MySQL database.

Here is the PHP code:

$inbox = imap_ope         


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-30 02:52

    This happens because the emails are normally Quoted-printable encoded. The = is a soft line break and =20 is a white space. I think, you could use quoted_printable_decode() on the message so it shows correctly. About the blank emails, I don't know, I would need more details.

    Basically:

    //get message body
    $message = quoted_printable_decode(imap_fetchbody($inbox,$email_number,1.1)); 
    

提交回复
热议问题