Send email from within app using phone's default mail account

Hi there,

I think a useful function for Corona would be to have the ability to send an email using your phone's default mail account and attach items from within your app such as from a text field or a picture. Using a very simple example, lets say you have a note taking app where you can type in a text field. You would be able to have an email button that would create an email with these notes in the body.

+1

+2

+1

Can Carona add an email function that would perform like the "Tell a Friend" feature in the app store (in each app below the ratings label)?

Theres a way you can "send email" through your application. Its kind of a hack but it works. You won't be able to attach any images or files but you can prewrite text.

What you need to do is to send a url request to the device and ask it to launch email.

Here's an example,

system.openURL( "mailto:?subject=Cool%20Subject&body=Thisisthebody")

Source for more parameters:
http://email.about.com/od/mailtoemaillinks/a/mailto_elements.htm

+1
This is so needed by our published app right now!! Woke up to 8 users wanting this..

Willy J.

+1

+1

+1

+ 1

+1

The method posted by Clement is what I use in my apps. Works swimmingly.

..but unfortunately without file attachment.

But can you use Clements method to somehow send dynamic text? Like grab text from a text field or a variable?

The method Clement suggested works flawlessly. Albeit without attachments

Clement's way is great.
-----
aaaron: I concatenated variables into it... ie:

system.openURL( "mailto:?subject=Cool%20Subject&body=Thisisthebody and"..player1.."is the winner today")

seemed to work; hope it helps
----
Anyone: In the simulator I can just send the email and it goes and all is well...however I'm having a problem when I build for device (ios)
It works great when I click on the email button in my program and I can send the message, but I then become stuck in the email program and can't return without restarting my app. Does anyone who's made this work know if there is some kind of onComplete listener or something that I should be using?

Clements method works but on iOS it exists the application after the email is sent.

It would be great to be able to send an email within the app and attachments will be wonderful.

Shahar

views:2080 update:2011/9/17 18:17:57
corona forums © 2003-2011