首先,我不明白为什么你总是提醒服务不可用。isAvailable
如果启用或未启用,您有一个变量。您从官方链接复制的这一行意味着您应该检查 isAvailable 是真还是假。例如
isAvailable ? alert('available') : alert('not available');
然后,您需要设置正确的电子邮件帐户才能使用该插件。所以设备需要能够发送电子邮件。
然后您错过了回调,它可以为您提供有关事件的重要详细信息,并且您没有以正确的方式使用所有需要的属性。
cordova.plugins.email.open({
to: Array, // email addresses for TO field
cc: Array, // email addresses for CC field
bcc: Array, // email addresses for BCC field
attachments: Array, // file paths or base64 data streams
subject: String, // subject of the email
body: String, // email body (for HTML, set isHtml to true)
isHtml: Boolean, // indicats if the body is HTML or plain text
}, callback, scope);
所以你的代码应该是这样的:
cordova.plugins.email.open({
to: ['receiver address or multiple elements for more'],
subject: 'Sent with mailto',
body: 'body of the email!'
}, function(data) { alert('callback'); alert(data);}, this);