Using mailto: to mail a link containing a querystring

O

Olaf

I have a ASP page that after saveing data to the database it will
write the following script code to the page:
<script>
document.location='mailto:eek:[email protected]?body=http://myWebserver/page.asp?docID=17&login=HAL&subject=report';
</script>

This all looks well but when I se the actual mail the &login=LAS part
of the link in the body is not there! The subject is correct! It all
looks ok apart from the missing part of the links querystring.

I tried to use Server.UrlEncode but that just left the body of the
mail compleatly empty.

/best regards Olaf
 
E

Evertjan.

Olaf wrote on 09 aug 2004 in comp.lang.javascript:
I have a ASP page that after saveing data to the database it will
write the following script code to the page:
<script>
document.location='mailto:eek:[email protected]?body=http://myWebserver/page.as
p?docID=17&login=HAL&subject=report'; </script>

This all looks well but when I se the actual mail the &login=LAS part
of the link in the body is not there! The subject is correct! It all
looks ok apart from the missing part of the links querystring.

I tried to use Server.UrlEncode but that just left the body of the
mail compleatly empty.

How would the last two "&"s know which "?" they have to follow?

In other words:

the mail body could contain:
http://myWebserver/page.asp?docID=17
and the mail login:
HAL
and the mail subject:
report

but there is no mail login, so where has HAL to go?.

Again in other words: you cannot do that.

Moreover the "mailto'-protocol is not clearly defined over different mail
clients.

===========================

If you really want to get somewhere try this:

document.location=
'mailto:eek:[email protected]?body=http://myWebserver.se/docID17.HAL.report.xyz'

and when the recipient wants to connect your customized 404.asp page will
detect .xyz and redirect this nonexisting URL to where it should be
(page.asp) and have docID17, HAL and report in session variables.
 
I

Ivo

"Olaf" wrote
I have a ASP page that after saveing data to the database it will
write the following script code to the page:
<script>
document.location='mailto:eek:[email protected]?body=http://myWebserver/page.asp?doc
ID=17&login=HAL&subject=report';
</script>

This all looks well but when I se the actual mail the &login=LAS part
of the link in the body is not there! The subject is correct! It all
looks ok apart from the missing part of the links querystring.

I tried to use Server.UrlEncode but that just left the body of the
mail compleatly empty.

Use the built-in escape function to encode the url:
document.location='mailto:eek:[email protected]?body='+escape('http://myWebserver/pa
ge.asp?docID=17&login=HAL')+'&subject=report';

--Iv
 
M

Michael Winter

I have a ASP page that after saveing data to the database it will
write the following script code to the page:
<script>
document.location='mailto:eek:[email protected]?body=http://myWebserver/page.asp?docID=17&login=HAL&subject=report';
</script>

This all looks well but when I se the actual mail the &login=LASpart of
the link in the body is not there! The subject is correct!It all looks
ok apart from the missing part of the linksquerystring.

I tried to use Server.UrlEncode but that just left the body of themail
compleatly empty.

The mailto scheme is flawed and should be avoided. It would be much more
reliable to use a server-side mail script. There are plenty of them around
and you'll have no problems setting the subject, or any other field for
that matter.

I'll stop there though. This subject has been done to death.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top