php imap - get body and make plain text

后端 未结 6 1908
故里飘歌
故里飘歌 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:43

    Regarding the blank emails, check the encoding of the mail.

    If it is a binary encoded mail then you will get blank mails when you try to insert them into a mysql text field.

    Try shifting every mail to UTF-8 and then insert it

    iconv(mb_detect_encoding($mail_content, mb_detect_order(), true), "UTF-8", $mail_content);

提交回复
热议问题