Phonegap电子邮件插件的问题

时间:2019-06-04 15:44:39

标签: email phonegap

我正在构建PhoneGap跨平台应用程序,并且正在尝试使用cordova电子邮件编写器插件。我正在使用在线Adobe phonegap构建器构建应用程序。 我使用了一些示例代码,如下所示,在我构建和运行该应用程序时,该代码告诉我“是否可以使用电子邮件移动功能?否” 该消息是从我按下按钮时运行的示例代码中触发的,在此我仅想看到电子邮件应用程序打开并用预定义的消息填充的那一刻。 应用程序版本在PhoneGap版本上没有错误,因为ive在我的config.xml中包含了对该插件的引用。 还有其他我想念的东西吗? 谢谢 问候

{

document.addEventListener('deviceready', function () {
    cordova.plugins.email.isAvailable(
        function (isAvailable) {
            alert("is email mobile available? " + (isAvailable ? "Yes" : "No"));
            if(isAvailable){
             window.plugin.email.open({
                 to:      'test@test.com',
                 subject: 'Greetings',
                 body:    'How are you? Nice greetings from Leipzig'
             }, callback, scope);
           }
        }
    );
}, false);

function callback(){
    console.log("callback function");
}

function scope(){
    console.log("scope function");

}

1 个答案:

答案 0 :(得分:0)

使用cordova-plugin-email

Function SentEmail(){     
  window.plugin.email.isServiceAvailable(function (isAvailable) {
                if(isAvailable)
                {
                  window.plugin.email.open({
                                to:          [Your to email address],
                                cc:          [''],
                                bcc:         [''],
                                subject:     "subject,
                                body:        "<br/> your body content",
                                isHtml:      true
                       });
                 }
                 else
                 Alert('Please add an email account on this device to make email service available.');
}
相关问题