x


Application.OpenURL for email on mobile

Does Application.OpenURL("mailto:address@domain.com") work for popping up a native email prompt on mobile?

http://unity3d.com/support/documentation/ScriptReference/Application.OpenURL.html

more ▼

asked Apr 30 '11 at 05:05 AM

ina gravatar image

ina
3.3k 492 549 602

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Yes. Using Application.OpenURL() you could open safari, maps, phone, sms, mail, youtube, itunes, app store and books store. You could find all the url schemes you could need here These are for Objective-C but if you get the idea of the url scheme it would be really easy to do it on Unity. Here you have an example of a simple script to send a mail with address, subject and body.

C# mail example:


public string email;

public string subject;

public string body;

// Use this for initialization
void Start () {
    Application.OpenURL("mailto:" + email + "?subject:" + subject + "&body:" + body);
}

more ▼

answered May 06 '11 at 05:14 PM

David gravatar image

David
68 3 3 5

speaking of which, is there an easy way to integrate objective c with unity

May 07 '11 at 02:53 AM ina

do these url schemes also work on android?

May 07 '11 at 05:00 AM ina

I don't think this schemes would work on android and i don't have an android to check it but there would be some android schemes for sure. About unity and objective-c integration. Check this tutorial: http://clevermartian.com/blog/?p=59 I find it really interesting

May 07 '11 at 10:26 AM David

There is nothing iPhone-specific about these schemes. They work fine with Android (and web, and standalone).

Jun 03 '12 at 11:33 PM Waz

Hey guys, I'm having a problem with Application.OpenURL, When I use it to open a link it works fine (on both editor and Android) but when I replace the link with "mailto" it doesnt do anything on the editor and it crashes on Android (but it works fine if I manually paste the link on my browser). Can anyone help me with this. Is there something wrong with my Unity software? I just upgraded to the latest one...

Jun 11 '12 at 01:03 AM Sussino
(comments are locked)
10|3000 characters needed characters left

hey

Application.OpenURL("mailto:" + email + "?subject=" + subject + "&body=" + body); }

not :, correct is =

more ▼

answered Jun 15 '12 at 12:10 PM

shinriyo_twitter gravatar image

shinriyo_twitter
6

It's not a very well written answer and looks even more like it should be a comment to david's answer, but it's correct ;)

Jun 15 '12 at 12:14 PM Bunny83
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2480
x2000
x413
x50
x49

asked: Apr 30 '11 at 05:05 AM

Seen: 3875 times

Last Updated: Jun 15 '12 at 12:14 PM