Alan West
Alan West

Reputation: 3

Cordova - Open native email app from button click

When writing a native IOS app for example, you can open the native "Mail" app from a button click within an app. The email will come up pre-filled with certain data (send-to address, subject, body, etc.).

How can I simulate this across all devices using HTML5/Javascript in my cordova app?

Upvotes: 0

Views: 3823

Answers (2)

Adrian
Adrian

Reputation: 91

Also, since cordova 3.6.3 you alo need to include the following permission in your config.xml.

<access origin="mailto:*" launch-external="yes"/>

Upvotes: 7

JMac
JMac

Reputation: 1756

Using HTML5, you can do this with an anchor tag in your .html file. Here is an example:

<a href="mailto:[email protected]?subject=Example Subject 
&body=Thanks for the help!">Send an email</a>

This will work across all devices and resort to native functionality to handle the email task.

Upvotes: 8

Related Questions