Search code examples
iosemailionic-frameworkionic4mailto

Ionic 4 not opening external/default emailing app on IOS device, whilst working on Android


I have written a button to open the phone's default emailing app from my app. It currently works for android and does not work at all for IOS. I am not sure what is wrong and there is not too much information online about this topic. If anyone could guide me, I would be grateful.

Code I have tried and it fails for IOS and works for Android are as follows:

<ion-button expand="block" (click)="emailTest()">
   <ion-label>[email protected]</ion-label>
</ion-button>

emailTest(){
  this._platform.ready().then(() => {
      window.open('mailto:[email protected]');
  });
}
<ion-button expand="block">
   <a href="[email protected]" style="color:white" >[email protected]</a>
</ion-button>
<ion-button expand="block" (click)="emailTest()">
   <ion-label>[email protected]</ion-label>
</ion-button>

emailTest(){
  window.open("mailto: [email protected]",'_system');
}

Solution

  • inAppBrowser did not work for the IOS device, however using the email composer in Ionic worked for IOS and android. It does not work for browser but that is part of my project, here is a link!