Textfield Email Link

Can someone please correct this code for me,

ShowURL("mailto: + str(txtemail.text)")

I have also tried

ShowURL("mailto: "+ str(txtemail.text))

Neither seem to work

I have in the mousedown event “Return True” and am placing this code in the mouseup event.

Thanks

whats in txtemail.text ?
the person email address ?
you really dont need a str around that

Hi Norman, yes txtemail.text is an email address, just tried both versions without str and neither work.

I am trying to make the users email client open when the email address is clicked on.

Thanks.

In the first example, you have the quotation encapsulating the entire str(txtemail.text) part.
In the second example, you have a space after the “mailto:”. Don’t do that… use this:

ShowURL("mailto:" + txtemail.text)

That should work exactly as posted.

EDIT:
Better yet, use this:

ShowURL("mailto:" + ltrim(rtrim((txtemail.text))

Still no go, have double checked the code.

Example project for you: https://dl.dropboxusercontent.com/u/10504478/email.xojo_binary_project
(I made it because I was curious if it would work :stuck_out_tongue: )

Try just something as simple as

ShowUrl(“mailto:norman@xojo.com”)

That should open the default mail client
If that doesn’t you have other issues that are NOT related to ShowUrl - no default handler for the URI scheme exists

No need to do a LTrim and RTrim, just do a Trim as it does both ends of the string in one go…

[quote]http://documentation.xojo.com/index.php/Trim
Returns the string passed with leading and trailing whitespaces removed[/quote]

[quote=125559:@Norman Palardy]Try just something as simple as

ShowUrl(“mailto:norman@xojo.com”)

That should open the default mail client
If that doesn’t you have other issues that are NOT related to ShowUrl - no default handler for the URI scheme exists[/quote]

Looks like other issues norman, where would I start.

We could start by you describing what happens instead of opening your default mail client. Are you on Mac or on Windows?

Hi Beatrix, I’m on Windows, nothing at all happens, the default mail client is Outlook.

When I set one of the other textfields to open the web browser, everything works fine there.

Thanks Shane

[quote=125568:@Shane Rampling]Hi Beatrix, I’m on Windows, nothing at all happens, the default mail client is Outlook.

When I set one of the other textfields to open the web browser, everything works fine there.[/quote]

First of all, you want to check if Windows is set up right for mailto:.

Paste this in Internet Explorer address bar and hit Return :

mailto:norman@xojo.com

If it opens Outlook, then Windows is correctly set up. If nothing happens, then we will show you how to set it up.

Nothing happens.

Fixed the default apps, will now try again.

All fixed, thanks to all who help, Windows 8 doesn’t seem to setup default apps as other versions did.

Thanks.

Since Windows 8 comes with no mail client installed, Outlook should have set the default app upon its installation.

I just verified with my Windows 8.1 and indeed, nothing happens as well, since I never installed any email client.

If your app is to be sold, you may want to add to it a mail sending option with SMTPSocket, to make sure what happened to you does not happen to your customers. And as default send mail from your app, with an option to use the installed mail client. Could save you a lot of support requests and angry customers…

Time to switch to Mac!

:slight_smile:

[quote=125755:@Shane Rampling]All fixed, thanks to all who help, Windows 8 doesn’t seem to setup default apps as other versions did.
[/quote]
Seriously ? like why would anyone want one of those :stuck_out_tongue:

Microsoft decided that email was of no use in an OS :s