Вывод HTML из getRawContent () Imap - Zend Mail - PullRequest
0 голосов
/ 11 мая 2018

Поэтому я использую ZEND MAIL, чтобы установить IMAP-соединение с Gmail для получения писем

Итак, у меня есть

$emailContent = $mail->getRawContent($id);

Что заставляет меня выглядеть так

"--000000000000fe4838056bb3f88c\r\nContent-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n The best of Gmail, wherever you are\r\n[image: Google]\r\n[image: Nexus 4 with Gmail]\r\n\r\nHi Genius\r\n\r\n\r\nGet the official Gmail app\r\n\r\nThe best features of Gmail are only available on your phone and tablet with\r\nthe official Gmail app. Download the app or go to gmail.com\r\n<https://www.gmail.com/> on your computer or mobile device to get started.\r\n\r\n[image: Google Play]\r\n<https://play.google.com/store/apps/details?id=3Dcom.google.android.gm>  [i=\r\nmage:\r\nApp Store] <https://itunes.apple.com/en/app/gmail/id422689480?mt=3D8>\r\n\r\n\r\n[image: Gmail icon] Happy emailing,\r\nThe Gmail Team\r\n=C2=A9 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043\r\n\r\n--000000000000fe4838056bb3f88c\r\nContent-Type: text/html; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n<!DOCTYPE html>\r\n<html><head><meta http-equiv=3D\"content-type\" content=3D\"text/html;charset=\r\n=3DUTF-8\"/><title>The best of Gmail, wherever you are</title></head><body s=\r\ntyle=3D\"background-color:#e5e5e5; margin:20px 0;\"><br/><div style=3D\"margin=\r\n:2%;\"><div style=3D\"direction:ltr; text-align:left; font-family:'Open sans'=\r\n,'Arial',sans-serif; color:#444; background-color:white; padding:1.5em; bor=\r\nder-radius:1em; box-shadow:1px -5px 8px 2px #bbb; max-width:580px; margin:2=\r\n% auto 0 auto;\"><table style=3D\"background:white;width:100%\"><tr><td><div s=\r\ntyle=3D\"width:90px; height:54px; margin:10px auto;\"><img src=3D\"https://ser=\r\nvices.google.com/fh/files/emails/google_logo_flat_90_color.png\" alt=3D\"Goog=\r\nle\" width=3D\"90\" height=3D\"34\"/></div><div style=3D\"float:right; padding-to=\r\np:2em;\"><img src=3D\"https://ssl.gstatic.com/accounts/services/mail/msa/welc=\r\nome_nexus.png\" alt=3D\"Nexus 4 with Gmail\" style=3D\"border:0; margin-right:1=\r\n0px;\" width=3D\"155\" height=3D\"242\"/></div><div style=3D\"width:90%; padding-=\r\nbottom:10px; padding-left:15px\"><p><img alt=3D\"\" aria-hidden=3D\"true\" src=\r\n=3D\"https://ssl.gstatic.com/ui/v1/icons/mail/images/gmail_logo_large.png\" s=\r\ntyle=3D\"display:inline-block; max-height:10px; margin-right:5px;\"/><span st=\r\nyle=3D\"font-family:'Open sans','Arial',sans-serif; font-weight:bold; font-s=\r\nize:small; line-height:1.4em\">Hi Genius</span></p><p><span style=3D\"font-fa=\r\nmily:'Open sans','Arial',sans-serif; font-size:2.08em;\"><br/>Get the offici=\r\nal Gmail app</span><br/></p></div><p></p><div style=3D\"padding-left:15px\"><=\r\np style=3D\"size:small; line-height:1.4em;\">The best features of Gmail are o=\r\nnly available on your phone and tablet with the official Gmail app. Downloa=\r\nd the app or go to <a href=3D\"https://www.gmail.com/\" target=3D\"_blank\" sty=\r\nle=3D\"text-decoration:none; color:#15C\">gmail.com</a> on your computer or m=\r\nobile device to get started.</p><p style=3D\"line-height:2em; margin-right:1=\r\n70px;\"><a href=3D\"https://play.google.com/store/apps/details?id=3Dcom.googl=\r\ne.android.gm\" style=3D\"text-decoration:none\"><img alt=3D\"Google Play\" width=\r\n=3D\"127\" height=3D\"44\" src=3D\"https://ssl.gstatic.com/accounts/services/mai=\r\nl/buttons/google_play_en.png\" style=3D\"border:0\"/></a>&nbsp;&nbsp;<a href=\r\n=3D\"https://itunes.apple.com/en/app/gmail/id422689480?mt=3D8\" style=3D\"text=\r\n-decoration:none;\"><img alt=3D\"App Store\" width=3D\"144\" height=3D\"43\" src=\r\n=3D\"https://ssl.gstatic.com/accounts/services/mail/buttons/apple_store_en.p=\r\nng\" style=3D\"border:0\"/></a></p></div><br/><br/>\r\n<div style=3D\"clear:both; padding-left:13px; height:6.8em;\"><table style=3D=\r\n\"width:100%; border-collapse:collapse; border:0\"><tr><td style=3D\"width:68p=\r\nx\"><img alt=3D'Gmail icon' width=3D\"49\" height=3D\"37\" src=3D\"https://ssl.gs=\r\ntatic.com/ui/v1/icons/mail/images/gmail_logo_large.png\" style=3D\"display:bl=\r\nock;\"/></td><td style=3D\"align:left; font-family:'Open sans','Arial',sans-s=\r\nerif; vertical-align:bottom\"><span style=3D\"font-size:small\">Happy emailing=\r\n,<br/></span><span style=3D\"font-size:x-large; line-height:1\">The Gmail Tea=\r\nm</span></td></tr></table></div>\r\n</td></tr></table></div>\r\n<div style=3D\"direction:ltr;color:#777; font-size:0.8em; border-radius:1em;=\r\n padding:1em; margin:0 auto 4% auto; font-family:'Arial','Helvetica',sans-s=\r\nerif; text-align:center;\">=C2=A9 2018 Google Inc. 1600 Amphitheatre Parkway=\r\n, Mountain View, CA 94043<br/></div></div></body></html>\r\n\r\n--000000000000fe4838056bb3f88c--"

Мне нужно найти лучший способ вывести только само сообщение

Я использую VUE js на внешнем интерфейсе и на данный момент могу просто вставить HTML-теги

...