Closed catapulte2 closed 2 years ago
The callback has no error parameter and the open
method does not return any Promise, the docs are clear on that
cordova.plugins.email.open({
from: String, // sending email account (iOS only)
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
isHtml: Boolean // indicats if the body is HTML or plain text (primarily iOS)
}, () => {
console.log('Finished')
})
@catapulte2 Did you find any solution yet? I am facing a same issue.
@Topiya did you try the code I posted here in the thread?
With me it works on Android 11
Hi Topiya, We finally stop using Ionic and Cordova because we spent too much time searching for stability bugs. I don't think it come from the Cordova plugin itself but from all the compile integration wich make more and more it's live alone. Sometime plugins work, sometime not... Nobody know why. ;-( Regards,
The callback has no error parameter and the
open
method does not return any Promise, the docs are clear on thatcordova.plugins.email.open({ from: String, // sending email account (iOS only) 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 isHtml: Boolean // indicats if the body is HTML or plain text (primarily iOS) }, () => { console.log('Finished') })
@jfoclpf I am getting below error while using above code.
ERROR TypeError: Cannot read property 'email' of undefined
In "normal" situation, this is just because Plugin is not correctly installed or define. Try Remove it and reinstall it. If you are using Ionic when we had this case, often solution was to remove all platform the re-install. Example : ionic cordova platfrom rm android; ionic cordova platform add android. Be sure to make a backup before in case of...
@Topiya as @catapulte2 referred you have a problem with installation, just check on the console the result of typeof cordova.plugins.email
. It should be an object.
Thank you. I have re-added android platform.
Now error is gone but main issue still persist, App crashes on cordova.plugins.email.open
function call.
@Topiya what exact error is shown on console.log ?
when you type in console dev tools typeof cordova.plugins.email
and typeof cordova.plugins.email.open
what do you see?
Hi, Thanks for your job. It works perfectly on previous versions of Android but for information on Android 11, emailcomposer.open(email) do nothing. It don't call .then nor error or catch functions call. For moment I bypass this like this :
var ok : boolean = false; this.emailComposer.open(email).then(result=>{
// Call on all release before Android 11 ok = true; },e=>{ //never call if android 11 }).catch(e=>{ //never call if android 11 }) setTimeout(() => { if(!ok){ //my call to Window.open with mailto function for android 11 devices } },3000);
If you want me to make tests modifications on my code, your welcome.
Best regards,
Eric