embedding a hyperlink inside a mailto reference

Is it possible to include a hyperlink inside the body reference of a mailto call in html?

For example, using the following example:
<a href="mailto:test@somewhere?body=Test body">email with default body</a>

Is it possible to change the "Test Body" reference to be a link to www.google.com?

Thanks
LVL 10
dj88Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
You need to encode the value:
email with default body
0
hieloCommented:
this will help you encode your data:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
<title></title>
</head>
<body>
<form>
	<div>Type Raw value then click in "Encoded Value"</div>
	<div>"Raw" Value: <textarea name="raw" onchange="encoded.value=encodeURIComponent(this.value)" rows="10" cols="80" ></textarea></div>
	<div>Encoded Value: <textarea name="encoded" rows="10" cols="80"></textarea></div>
</form>
</body>
</html>

Open in new window

0
ncooCommented:

As HTML
 
<a href="mailto:test@somewhere?body=Test body&lt;a href='http://google.com'&gt;google&lt;/a&gt;">email with default body</a>
 
AS TEXT
<a href="mailto:test@somewhere?body=Test body http://google.com">email with default body</a>

Open in new window

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ncooCommented:
Sorry you wanted Test Body replaced, here you go:
As HTML
 
<a href="mailto:test@somewhere?body=&lt;a href='http://google.com'&gt;google&lt;/a&gt;">email with default body</a>
 
AS TEXT
<a href="mailto:test@somewhere?body=http://google.com">email with default body</a>

Open in new window

0
dj88Author Commented:
Thanks for the responses...

In both cases, I get the following results in the body of the email.  Is there anyway to actually just put the hyperlink in the body rather than the HTML?

<a href="http://www.google.com">google</a>

Am I doing something wrong?
0
hieloCommented:
I didn't realize my original post got mangled! Take my second post, save it as encoder.html

then in the top text area type the body of whatever you want on the body. Then click on the lower text area and copy the result from the lower textarea and put that as the value of the "body". So if you were to type
http://www.google.com/
 
the result will be:
<a href="mailto:test@somewhere?body=http%3A%2F%2Fwww.google.com%2F">email with default body</a>
 
which is what you need.

Open in new window

0
hieloCommented:
>>the result will be:
I meant:
 ... the result will be http%3A%2F%2Fwww.google.com%2F

so on your original post:
<a href="mailto:test@somewhere?body=Test body">email with default body</a>

you need to assign that result to body:
<a href="mailto:test@somewhere?body=http%3A%2F%2Fwww.google.com%2F">email with default body</a>
0
dj88Author Commented:
That's a little closer - However, I want it the body of the email to say:

Google (or whatever)

but link to http://www.google.com

So, is it possible to edit the name of the link so to speak?
0
hieloCommented:
Then in the top text area you need to type:
<a href="http://www.google.com/">Google</a>
 
and the result that you get in the lower textarea you assign it to "body"

Open in new window

0
hieloCommented:

<a href="mailto:test@somewhere?body=%3Ca%20href%3D%22http%3A%2F%2Fwww.google.com%2F%22%3EGoogle%3C%2Fa%3E">email with default body</a>

Open in new window

0
dj88Author Commented:
Maybe I'm doing something wrong - but that give me the following in the body of the email:

<a href="http://www.google.com/">Google</a>
0
hieloCommented:
>>Maybe I'm doing something wrong - but that give me the following in the body of the email:
Yes, that is what I was expecting, but I see what you are trying to do. As far as I know, there is no "flag" to specify that you are interested in composing an html email. To clafy, there is the:
body,subject,cc, etc, "flags" but there is not "format=mail" type of flag. The closest you will get is what you are already doing, and hope that the email client of the user "deciphers" that line and interprets it as an HTML email.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
b0lsc0ttIT ManagerCommented:
All credit to Hielo for this but I noticed this Q and was following it.  His last post is correct that you will be at the mercy of the email client (i.e. the user's email software).  I don't know any that would reliably interpret the code as you want.  Hielo did provide the way to send it to the mailer if it would work but most will just treat what is in "body" as a text email.  All credit to Hielo for that and I just wanted to confirm.
I really suggest you consider using server side script instead for handling mailing.  Mailto is a poor option in my opinion for MANY reasons.  In this case a server script could make the email just as you want and you would get your result.  You would also have the benefit of a method that doesn't rely on the client's email program, doesn't expose your email address to bots/spiders, and is more professional.  Almost all server side languages have an easy way to send emails so making a script to do this (or finding one online) is easy and basic.  The only requirement is a server side language/techonology and some mail "object" or class.
If you have a question about what I have said let me know.  Please keep in mind the last part is a little beyond what you asked here, which Hielo seems to have answered. :)
bol
0
dj88Author Commented:
I appreciate all the comments and suggestions...
0
dj88Author Commented:
Thanks for the help...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.