首页 > 解决方案 > ActionSheet - Ionic 5 - 所有可用邮件 - Ios

问题描述

目前我正在我的 ionic 5 应用程序中实现电子邮件编写器插件。当应用程序构建在 Android 手机上并且我激活插件时,会出现一个操作表,其中包含我手机上所有可用的邮件提供商,例如(Gmail、Yahoo、Outlook 等)。我怎样才能实现一个内置的 iOS 来做同样的事情。目前只能使用 ios 邮件,但我想让用户选择使用不同的邮件提供商发送邮件,就像 android 一样。我尝试使用操作表插件,也尝试使用社交分享插件,但都没有按照我想要的方式工作。

下面是我的电子邮件编辑器插件的代码。请问有什么帮助吗?

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
}

}

标签: javascriptemailionic5socialsharing-pluginactionsheet

解决方案


推荐阅读