How to parse HTML email using PHP IMAP?

I am trying to parse HTML data in an email using PHP IMAP functions.

When I echo imap_body($Mailbox, 1); e.g. containing HTMl seems to be converted to a different encoding (MIME I suspect)

Here is an example $body snippet:

 <TH=20 style=3D"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: = 5px; COLOR: #fff; PADDING-TOP: 5px; BORDER-BOTTOM: #6eafd0 1px solid; = BACKGROUND-COLOR: #004454"=20 align=3Dleft>Site</TH> 

How to convert received body data to parsed HTML?

thanks

+4
source share
1 answer

Yes, it looks old MIMEish. Maybe try $decoded = quoted_printable_decode ( $body );

The "3D" part is the distribution: "The US-ASCII equal sign (decimal value 61) must be represented by" = 3D "( wiki for encoding with quotes ).

+11
source

Source: https://habr.com/ru/post/1339901/


All Articles