Solved

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

Posted on 2014-10-19
7
148 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add image on html mail 6 27
Alert after MVC form submitted 1 22
Extracting content from meta tag PHP MYHTML DOM 3 21
Set time on Session (ASP) 14 23
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

829 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