Reputation: 103
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: '[email protected]', // 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
}
}
Upvotes: 1
Views: 144