Forum Moderators: open

Message Too Old, No Replies

How can I insert an <a href> into a <a href="mailto:"> tag?

I need to embed a <a href> link into the body section of a <a href="mailto:

         

daveo

10:36 am on May 13, 2004 (gmt 0)

10+ Year Member



I need to embed a <a href> link into the body section of a <a href="mailto:"> tag to generate an email such as below.

To: you@yourdomain.com
Subject: Test
Body: Click HERE to go to the webpage.

When I put the <a href> tag into <a href="mailto:"> it breaks the original <a href> link.

I would appreciate any help if there is any way around this that anybody can think of?

Cheers

Dave

MatthewHSE

11:04 am on May 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like you might just need a contact form or a "Tell a Friend" script. What is the purpose you're trying to accomplish?

daveo

11:14 am on May 13, 2004 (gmt 0)

10+ Year Member



It's all to do with conflict checking in a legal firm.

Solicitors enter clients details into a SQL-Server DB via our intranet. All the other solicitors have to check on the intranet for possible conflicts. If they are aware of a conflict, we want them to be able to click on the relevant record to generate an email to the originator with a link back to the record in question.

I hope that makes sense to you.

Rhys

11:29 am on May 13, 2004 (gmt 0)

10+ Year Member



I think that if you replace the tag brackets < and > with &lt; and &gt; in the Body: part of the code, it will work OK.

pete_m

11:34 am on May 13, 2004 (gmt 0)

10+ Year Member



Many email clients will automatically convert urls in the email body into links.

If you make sure the URL has the http:// prefix then Outlook (or whatever) should show it as a link.

DrDoc

5:18 pm on May 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No matter if you use <> or &lt; &gt; it will not show it as text, not create it as HTML code...
Plus, you realize the link will not work in all browsers, and may not work as you expect depending on mail client.

In my opinion -- it's asking for trouble...

iamlost

6:54 pm on May 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your initial approach is contrary to standards [w3.org]:
13.2.3 Nested links

Links and anchors defined by the A element may not be nested.

ILLEGAL EXAMPLE:
The following example illustrates nested links. Nested links are not permitted.

This text contains
<A name="outer-anchor" href="next-outer.html">an outer anchor and
and link and <A name="inner-anchor" href="next-inner.html">an inner
anchor and link.</A></A>

As you seem to be talking about email within an intranet system you might consider using an email client that recognizes extentions i.e. "?Subject=****&body=****".

DrDoc

7:03 pm on May 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As you seem to be talking about email within an intranet system you might consider using an email client that recognizes extentions i.e. "?Subject=****&body=****".

I believe that's what the initial post was about all along ;)
...something like:

<a href="mailto:foobar@example.com?Subject=Test&amp;Body=Click <a href='http://www.example.com'>here</a> to go to the site">E-mail</a>

iamlost

8:06 pm on May 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I often miss the obvious ;-)
Hide it and I'll trip over it every time.

I meant something like the following change to DrDoc's example:
<a href="mailto:foobar@example.com?Subject=Test&amp;Body=Click href='http://www.example.com'hereto go to the site">E-mail</a>

It drops the inner <a> and in many email clients just the url itself will auto generate a link.

HyperGeek

9:09 pm on May 13, 2004 (gmt 0)

10+ Year Member



I don't suggest putting HTML in an anchor.

Just pass on the url in plain text. Some folks don't have HTML enabled inboxes and the code will show up causing further confusion.

You should really be running a script for this. We use ASPmail and a simply response/request for stuff like this.

Anything worth doing is worth doing right - and your idea is simply not the most efficient way to go about it. However, doing it the other way may require more knowledge than you currently have on the subject.

I would suggest looking for a free mail script in either ASP or PHP.

daveo

12:40 pm on May 14, 2004 (gmt 0)

10+ Year Member



It drops the inner <a> and in many email clients just the url itself will auto generate a link.

Sometimes, the simplest things work!

By removing the inner <A> tags, Outlook has resolved the link itself. Since everybody in the company has then same software throughout, this approach is fine.

Thanks for all your help everybody.

Dave