parsing raw email in php

前端 未结 14 506
猫巷女王i
猫巷女王i 2020-12-23 20:50

I\'m looking for good/working/simple to use php code for parsing raw email into parts.

I\'ve written a couple of brute force solutions, but every time, one small cha

14条回答
  •  旧巷少年郎
    2020-12-23 21:25

    This https://github.com/zbateson/MailMimeParser works for me, and don't need mailparse extension.

    getHeaderValue('from');          // user@example.com
    echo $message
        ->getHeader('from')
        ->getPersonName();                          // Person Name
    echo $message->getHeaderValue('subject');       // The email's subject
    
    echo $message->getTextContent();                // or getHtmlContent
    

提交回复
热议问题