目前,我正在ionic 5应用程序中实现email composer插件。当该应用程序在Android手机上构建并且我激活了该插件时,就会出现一个操作单,其中包含我手机上所有可用的邮件提供商,例如(Gmail,Yahoo,Outlook等)。我该如何实现为此目的而构建的iOS。目前只能使用ios邮件,但我想为用户提供选择,以选择使用Android之类的其他邮件提供商发送邮件。我尝试使用操作表插件,也尝试使用社交共享插件,但都无法按我想要的方式工作。
以下是我为Email Composer插件编写的代码。有什么帮助吗?
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
}
}