Solved

How do I create a hyperlink that works on all email systems?

Posted on 2014-10-19
7
141 Views
Last Modified: 2014-10-22
I am developing a web site using PHP and mySQL and at one point I need to send the user a link to reset their password.

In my design, the e-mail is sent using HTML and the link is programmed using the obvious <a href="http://... &c tag.

This works fine on most systems; however, users with iPad and iPhone report that nothing happens when they click the link, although other links that others send them are working.

When I ask to see the links that are working it appears that they are written in plain text and that the link is actually being generated on the fly by Apple's e-mail reader.   However this approach will presumably not work on all systems.

Is there a recommended method of sending a link in an e-mail that will work on all systems (unless of course the user has turned links off, in which case nothing will work).

Thanks in advance for any advice.
0
Comment
Question by:DavidRMason
7 Comments
 
LVL 19

Expert Comment

by:Peter Hutchison
ID: 40389738
The correct html tag is to use mailto:, not http:
<a href="mailto:email.address.here">Link to email address</a>
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 40389747
@Peter: on reset password links, they are links, not mailtos.

@David: all email clients I know will automatically create links from plain text.
0
 
LVL 19

Expert Comment

by:Peter Hutchison
ID: 40389978
Do you have a sample of the link (not the exact one) but approx syntax?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:DavidRMason
ID: 40390038
Peter - the body of the e-mail is created in PHP as follows:

$body='<html><body>'.
                'You have requested a password reset for the xxx web site.  '.
                'Please click the link below to set your password<br><br>'.
                '<a href="http://'.$host.'index.php?action='.$actionCode.'">Reset password</a>'.
                '</body></html>';
where the variable $host contains the web site name beginning www.... and the variable $actionCode contains a randomly generated string that is stored in MYSQL and will time-expire if not clicked promptly, and is linked to the user's e-mail address (which they have to re-enter after clicking the link to validate it).

This works fine except with 2 test members both using Apple devices (iPad and iPhone) who report that nothing happens when the click the link, although other links from other people work for them.

Sending in plain text and having the link created automatically in the user's mail system is a less elegant option as it means the full http://&c is exposed to the user, whereas all they need is a link whose text says "Reset password" that they can click.

As a backup I'm including an option to copy and paste the URL.

Thanks for your help.

David
0
 
LVL 19

Accepted Solution

by:
Peter Hutchison earned 500 total points
ID: 40390935
I think the html is incomplete and the Macs are being security conscience. So I would add a proper head section, a title
and possible a DOCTYPE line at the top to make it a valid html document.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40394863
I've seen a lot of "reset" emails say something like:

<a href="http://www.abc.com">Click Here to reset your password</a>. if this link doesn't work, please copy and paste the link below directly into your browsers address bar.

Reset Link - http://www.abc.com

this is a common and accepted practice, as it's always difficult to make ALL browsers happy these days :)
0
 

Author Closing Comment

by:DavidRMason
ID: 40396603
Peter - thanks for your help - putting a proper header in the html solved the problem.

I simply replaced the <html> tag above with

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
 </head>

and it now works.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
css, html 5 42
would like the bottom of this page to be smaller 3 27
Convert html page to a php post email form automatically? 10 55
Scroll 5 news at a time. 4 27
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

770 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