Help - Search - Members - Calendar
Full Version: HTML "mailto" code with hyperlinks
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
hodgsonmatt
Hi - I'm trying to create an email template that contains hyperlinks, but I know that nesting <a> tags is illegal in html.
Trying to figure out a way where I can create the body of the email and include two additional hyperlinks that the user will receive in their email and click on to take them to the respective web pages.
Any help would be appreciated!
pandy
It's actually worse than that. All characters that aren't allowed in URLs need to be escaped, URL encoded. For example spaces need to be replaced with %20. That goes for normal http:// links too, not only mailto links.

A link like this:
CODE
<a href="http://htmlhelp.com">Get HTML help!</a>

Needs to be rewritten like this:
CODE
%3Ca%20href=%22http%3A%2F%2Fhtmlhelp.com%22%3EGet%20HTML%20help!%3C/a%3E


Here's a page with some explanations and a thingamajig that helps with the rewriting.
http://www.blooberry.com/indexdot/html/top...urlencoding.htm
Christian J
I don't understand, why would the OP need to nest links, or put URL-encoded markup in the URL?
pandy
It's a mailto link with a link in the body of the email. But you are right, I don't think you can send HTML mail with mailto, so just the URL with :// escaped with %3A%2F%2F should be fine.

CODE
http%3A%2F%2F.htmlhelp.com
Christian J
QUOTE(pandy @ Aug 6 2016, 01:46 PM) *

It's a mailto link with a link in the body of the email.

Oh, I didn't even know you could do that.
pandy
Well, you can't. Not a HTML link. But an URL that just about every email client will turn into a link...

I didn't think about that it was a HTML link in the OP's example to begin with. I just went for the escaping. tongue.gif
Christian J
No, I meant inserting even plain text in the email body through the URL. I only knew about inserting a subject line. Are these things better supported today than the FAQ says? http://htmlhelp.com/faq/html/links.html#mailto-subject

And what if the user has no email client, and instead copies such a mailto URL (with body text) and pastes it into the recipient field of a new email at some webmail service like GMail, will the email still work?
pandy
I haven't seen any statistics about that, but I think it's fair to assume today's email clients support the standard options. I.e. cc, subject and body.

The RFS says this:

The user agent interpreting a mailto URL SHOULD choose not to create
a message if any of the headers are considered dangerous; it may also
choose to create a message with only a subset of the headers given in
the URL. Only the Subject, Keywords, and Body headers are believed
to be both safe and useful
.

https://www.ietf.org/rfc/rfc2368.txt

Alas I have no idea what "Keywords" refer to since no such header is defined in the RFC. tongue.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.