开发者

PHP - fetch the images from email body

开发者 https://www.devze.com 2022-12-08 06:29 出处:网络
Can anyone guide me a way to extract all the images that are part of the email body(not a开发者_JAVA百科s attachment) in PHP.

Can anyone guide me a way to extract all the images that are part of the email body(not a开发者_JAVA百科s attachment) in PHP. Please guide me if anyone has worked on this.

Regards, Justin Samuel.


Parse the HTML part with DOMDocument::loadHTML, get all <img> elements with getElementsByTagName('img'), check the src attribute of each <img> element, download the image (for example, using file_get_contents).


If there is image on an email, this one should be html.

So the image are define with a HTML tag like that

<img.....>

You have to look at the img HTML tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消