Issuing a mailto:

B

Brian

Hi,

I want to issue mailto from one of my pages. Basically to drop contact
information from a from to the body of the email and have the user enter the
desired address to send it to. I thought that I could use response.redirect
for this, but I get a "the page could not be displayed" error in my window
and not the outlook window. I am initiating this from the onclick of a
button. It does work with a HyperlinkButton, but I need to build the mailto
content before issuing the command.

Any Suggestions? Am I going about this the right way?

Brian
 
G

Guest

build your info, pass it back to the client through a javascript
"window.open()" perhaps.
 
A

Andy Fish

The first point to make is that mailto: is not covered by internet standards
and is generally considered bad practice for anything other than a simple
"contact me" link. For instance, it won't work if the user uses webmail or
hasn't properly configured the default email client.

specifying the body text as part of the link only works with certain
combinations of browser and mail client (IIRC it works in with IE and
Outlook Express but not Outlook)

my preference would normally be to send the email from the server (in
asp.net use System.Web.Mail). however, this does assume that your server has
access to an smtp server that can send the mail.

if you want to use mailto with dynamically generated text, and
response.redirect doesn't work, my next best guess would be to use something
like:

<body onload='document.location.href="mailto:blah blah<%=the server
generated content"%>'>

I haven't tested it so I don't know if that would work, but if it doesn't, I
can't think of any solution.

Andy
 
B

Brian

Thank you for the heads up on the issues with mailto. These are not an issue
in my case where this will be running in a controlled environment over our
Intranet. An the functionality was explicitly asked for.

After playing around some, I found the hyperlinkbutton works, but it is ugly
and doesn't get displayed the same way that my other buttons are. So I
thought of hiding it and causing a click from code, but there doesn't appear
to be a way to do this.

Anyway, I will have a look at you suggestion and keep digging.

Thanks

Brian
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top