PHP - fetch the images from email body
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.
精彩评论