1

At the moment I am implementing the email composer plugin in my ionic 5 application. When the app is built on an android phone and i activate the plugin, an action sheet comes up with all mail providers available on my phone, such as (Gmail, Yahoo, Outlook, etc). How can I implement an iOS built to do the same. At the moment only the ios mail can be used but i want to give the user the option to choose to send the mail with different mail providers just like android. I tried using the action sheet plugin and I also tried using the Social Sharing plugin, all don't work the way I want to.

Below is the code i have for the Email Composer Plugin. Any Help please?

PostSuggestion() {
const formBody = this.suggestion.controls.body.value;
let Emailsubject: string;
if (this.currentLanguage === 'en') {
  Emailsubject = 'Suggestion for abc';
} else {
  Emailsubject = 'Suġġeriment għal abc';
}
if (this.emailComposer.isAvailable()) {
  if (this.emailComposer.hasPermission()) {
    const email = {
      to: 'abc@abc.com', // the one we will be using
      subject: Emailsubject, 
      body: formBody, // get suggestion
      isHtml: true
    };
    this.emailComposer.open(email).then(() => {
      this.suggestionContents = '';
    });
  } else {
    console.log('No permission granted');
    window.alert('No permission granted'); // for testing on mobile
  }
} else {
  window.alert('User does not appear to have device e-mail account'); // for testing on mobile
}

}

Joanne Fsadni
  • 103
  • 1
  • 8
  • Its related to apps itself, gmail and outlook etc.. are defined in device as mail service, and any app on ios like mail or other should be registered by its provider as a amail service in order to give you more suggestion than mail. – Mostafa Harb Jun 25 '20 at 05:13
  • any idea how i can do this or what should i use please? – Joanne Fsadni Jun 30 '20 at 08:16
  • On ios, what mail providers do you have other than mail? – Mostafa Harb Jun 30 '20 at 08:31
  • I have outlook and gmail – Joanne Fsadni Jun 30 '20 at 11:13
  • Try to use x-social-sharing new plugin, its other than the normal social sharing plugin, and try it for ios, it should show all apps not just mails, if it shows all mail apps and whatsapp and the ther apps than the user can share data to, tell me that all mails appear, else also just ssy what appears. – Mostafa Harb Jun 30 '20 at 17:41
  • Tried using Can share via Email and then Share Via Email and filled in the parameters like this: this.socialSharing.shareViaEmail(formBody, Emailsubject, ['abc@gmail.com']).then(() => {//success}) Still not working tho :/ – Joanne Fsadni Jul 01 '20 at 05:17
  • Any solution @JoanneFsadni ? – jug Feb 05 '21 at 09:10
  • Unfortunatly no I had to keep on using the IOS Mail @jug – Joanne Fsadni Feb 09 '21 at 14:43

0 Answers0