Thursday, March 29, 2012

MailTo behind Button - Run at Server - Does not Launch Email Client

I'm trying to launch the user's email client [Outlook, Outlook Express,
Notes, etc.] using 'MailTo:'. So I put a button on an aspx page and wrote
some .vb code to use 'Mailto:' and it works on my development machine when I
press the button.

But when I publish the site to our server, pressing the button does not
launch the email client on the user's computer.

Is there a way - some code - that I can launch the user's email client using
MailTo?

Thanks
Larry Rebich"Larry Rebich" wrote:

Quote:

Originally Posted by

I'm trying to launch the user's email client [Outlook, Outlook Express,
Notes, etc.] using 'MailTo:'. So I put a button on an aspx page and wrote
some .vb code to use 'Mailto:' and it works on my development machine when I
press the button.


If it has to be a button you could use:

<form action="mailto:someone@.test.com">
<input type="submit" value="Send Email">
</form>

But this creates a security dialog.

You're better off using a hyperlink instead:

<a href="http://links.10026.com/?link=mailto:someone@.test.com">Email me</a>

But if you have to do it in code you could use a literal control on the page
and populate it when required on a postback with some javascript to open an
email:

litOpenEmail.Text = "<script language=""javascript""
type=""text/javascript"">window.open('mailto:someone@.test.com');</script>"

0 comments:

Post a Comment