By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Webpage to email

P: n/a
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
message.

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
email.

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

Thanks,
Kevin
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
lig
have you tried parsing or regex to find the relative urls and convert
them?

Jul 17 '05 #2

P: n/a
Yes,
find and replace....even the wordpad has that.
Bye

Jul 17 '05 #3

P: n/a
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,
Kevin

"Kevin" <ke***@wxREMOVE4SPAM3.com> wrote in message
news:zOHwd.587886$D%.451850@attbi_s51...
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
message.

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
email.

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

Thanks,
Kevin

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.