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?
 
hieloConnect With a Mentor Commented:
>>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
 
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.