Webpage to email

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Several times recently I've been asked to generate HTML email messages for
clients.  It would be very nice to be able to render an existing webpage in
such a way that it could be included as the HTML portion of an email

The problem is that web pages usually have some relative urls, such as for
images, links, stylesheets, backgrounds, etc. which wouldn't work in an

Does anyone know of a way (in PHP) to translate all the relative urls in a
document to absolute?


Re: Webpage to email

have you tried parsing or regex to find the relative urls and convert

Re: Webpage to email

find and replace....even the wordpad has that.

Re: Webpage to email

Apparently I wasn't clear in my first question-- I wanted a way to have PHP
transform an arbitrary url into a document that could be sent by email.  A
simple regex wouldn't work-- it would need to be smart enough to find all
relative references (e.g. href=,src=,background=, etc) and recognize that
things that might look like references but aren't in tags should be left
alone (e.g., content, javascript variables, etc.)

I did find a solution:  Inject an appropriate BASE URI into the document
<head> if one does not already exist.

Thanks for the replies though,

Quoted text here. Click to load it

Site Timeline