dj88
asked on
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@somewher e?body=Tes t body">email with default body</a>
Is it possible to change the "Test Body" reference to be a link to www.google.com?
Thanks
For example, using the following example:
<a href="mailto:test@somewher
Is it possible to change the "Test Body" reference to be a link to www.google.com?
Thanks
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>
As HTML
<a href="mailto:test@somewhere?body=Test body<a href='http://google.com'>google</a>">email with default body</a>
AS TEXT
<a href="mailto:test@somewhere?body=Test body http://google.com">email with default body</a>
Sorry you wanted Test Body replaced, here you go:
As HTML
<a href="mailto:test@somewhere?body=<a href='http://google.com'>google</a>">email with default body</a>
AS TEXT
<a href="mailto:test@somewhere?body=http://google.com">email with default body</a>
ASKER
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?
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?
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
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.
>>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@somewher e?body=Tes t body">email with default body</a>
you need to assign that result to body:
<a href="mailto:test@somewher e?body=htt p%3A%2F%2F www.google.com%2F">email with default body</a>
I meant:
... the result will be http%3A%2F%2Fwww.google.com%2F
so on your original post:
<a href="mailto:test@somewher
you need to assign that result to body:
<a href="mailto:test@somewher
ASKER
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?
Google (or whatever)
but link to http://www.google.com
So, is it possible to edit the name of the link so to speak?
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"
<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>
ASKER
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>
<a href="http://www.google.com/">Google</a>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
I appreciate all the comments and suggestions...
ASKER
Thanks for the help...
email with default body