Solved

HTML email; How to embed link inside sent email?

Posted on 2014-07-30
3
190 Views
Last Modified: 2014-07-30
My HTML email is arriving to its destination successfully, however the link is not click-able. It just says - This page. If I remove the <a> tags the link is click-able but shows the address and technical looking $number. What am I missing here? Thanks.

$body  = "<html>";
$body .= "<body>";
$body .= "<a http://www.mysite.com/page/" . $number. ">This page</a>";
$body .= "</body>";
$body .= "</html>";

$headers['MIME-Version'] = "1.0";
$headers['Content-type'] = "text/html;charset=UTF-8";
0
Comment
Question by:kadin
3 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 400 total points
ID: 40230465
Spot the difference

$body .= "<a href='http://www.mysite.com/page/" . $number. "'>This page</a>";

Open in new window

0
 
LVL 14

Assisted Solution

by:Renante Entera
Renante Entera earned 100 total points
ID: 40230476
Gary is right and you can actually simply do it like this:

$body .= "<a href='http://www.mysite.com/page/$number'>This page</a>";

Open in new window


Since you are using double quotes when setting a variable then those simple variables will automatically be parsed by PHP and there is no need for you to add extra (dots) to avoid confusions.

Hope this helps a lot...
0
 

Author Closing Comment

by:kadin
ID: 40230495
Thank you both.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now