Convert Html To Email Body With Embedded Images


It seems unbelieveable but I googled for more than an hour and found no code snipped!

Perhaps you know some good one. I would rather avoid creating such a parser myself as that require a lot of testing while I am squeezed on time.

I am looking for a proven PHPMailer-compatible solution to accomplish the following:

convert a html page code to an email body with embedded images

So, whenever something like this is found in HTML source:

<IMG SRC="foo.jpg" ALT="foo" />

it will be converted into something like:

<IMG SRC="" ALT="foo">

and appropriately encoded attachment will be added to an email unless it was already added before.

Any idea?