Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mailto: links not opening mail app on Android in cordova app

This is driving me crazy. I'm working on a Ionic app (Cordova, Angular etc). I have a contact us link which contains a mailto: href

href="mailto:[email protected]?subject=my%20App" 

I've read countless posts on SO that say you have to remove

<access origin="*"/> 

from the config.xml in the project root and replace it with:

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

Which I've done. When I run ionic build it gets added to the config.xml in platforms/android/res/xml. But no matter what I do the link doesn't open the mail app on any Android simulator (even when email is configured in the simulator).

Sadly I don't have a device to test on - so is this just a emulator thing or am I missing something?

like image 685
James J Avatar asked May 20 '15 16:05

James J


1 Answers

You must install the cordova plugin whitelist:

cordova plugin add cordova-plugin-whitelist 

or if you want to save the reference to your config.xml file:

cordova plugin add cordova-plugin-whitelist --save 

and that you have to add the intent to your config.xml file:

<allow-intent href="mailto:*" /> 

You can find more info here.

like image 130
LeftyX Avatar answered Sep 19 '22 18:09

LeftyX