Page 1 of 1

Problems sending HREF link in body of email

Posted: Thu Mar 29, 2007 12:42 pm
by lunny
We want to send an email containing a HREF link but having problems with escape characters or whatever.

So in the body of the mail we have

$bodyPT2 = "<a href =".$fullUrl.">link </a>";

where fullURL is a user inputted URL but when we open the mail we get

<a href =http://something/boom249.php>link </a>

instead of just showing

"link"

Any Help ? : (

Posted: Thu Mar 29, 2007 1:26 pm
by aaronhall
The escape character is the backslash (\)

You could do
$bodyPT2 = "<a href =\"".$fullUrl."\">link </a>";
or
$bodyPT2 = '<a href ="'.$fullUrl.'">link </a>';

Posted: Thu Mar 29, 2007 1:26 pm
by Christopher
You would need to create a MIME encoded email to have HTML links. You could always just put the URL into the email. Most readers will turn into a link:

Code: Select all

$bodyPT2 = $fullUrl;
You might want to look at SwiftMailer to help you easily create HTML emails. It is not that easy to create compatible MIME emails from scratch.