I’m using Cordova Email composer plugin for sending email. it works with IOS 12.4, but doesn’t work with IOS 13+ and Android is working fine.
the issue : doesn’t open email app in IOS 13+ version doesn’t through any errors. anyone have solution workaround?
this is my code
sendEmail(to: string,
cc: string,
bcc: string,
attachment: string,
subject: string,
body: string,
isHtml: boolean): void {
// Use the plugin isAvailable method to check whether the user has configured an email account
if (this.platform.is('android')) {
this._EMAIL.isAvailable()
.then((available: boolean) => {
//Check that plugin has been granted access permissions to user's e-mail account
this._EMAIL.hasPermission()
.then((isPermitted: boolean) => {
// Define an object containing the keys/values for populating the device
// default mail fields when a new message is created
let email: any = {
app: 'mailto',
to: to,
cc: cc,
bcc: bcc,
attachments: [attachment],
subject: subject,
body: body,
isHtml: isHtml
};
// Open the device e-mail client and create a new e-mail message populated with the
// object containing our message data
this._EMAIL.open(email).then(data => {
console.log("data", data)
})
.catch(error => console.log("err ope", error));
this.modalController.dismiss();
})
.catch((error: any) => {
// console.log('No access permission granted');
// console.dir(error);
});
})
.catch((error: any) => {
console.log('User does not appear to have device e-mail account');
// console.dir(error);
});
}
else {
console.log("IOS");
this._EMAIL.requestPermission().then(perm => {
console.log("perm:", perm);
if (perm) {
console.log("Perm:", perm);
// Define an object containing the keys/values for populating the device
// default mail fields when a new message is created
let email: any = {
app: 'mailto',
to: to,
cc: cc,
bcc: bcc,
attachments: [attachment],
subject: subject,
body: body,
isHtml: isHtml
};
// Open the device e-mail client and create a new e-mail message populated with the
// object containing our message data
this._EMAIL.open(email).then(data => {
console.log("data:", data)
})
.catch(error => console.log("err ope", error));
this.modalController.dismiss();
}
else {
console.log('No access permission granted');
}
}).catch(err => console.log("error", err));
}
}
}
1 post - 1 participant