react-native-mail
react-native-mail copied to clipboard
Success callback for android
Hi,
First of all, thanks for the great lib, this really saved my project! Just a little question tho, is there any way I can try to trigger some sort of success callback on android upon successful email sending completion? I know the doc said android will only do the callback upon error. So I was just wondering if there is any way to find out whether user has successfully sent the email?
Thanks in advance!
UPDATE: I've done a little bit of digging into your android code, I'm assuming it's almost impossible to do callback.invoke() anywhere in RNMail.java since as soon as the mail app is triggered, react native bridge would be down already and there's no way the android code can reach my app unless it listens to app state as well from the android side. I'm very new with android so I wouldn't know how to do that. If you can point me in the right direction that would be awesome!
Please let me know if there's other obvious workaround that I missed. :)
I have the exact same issue myself: I need to keep a trace of any email sent through the app (with the title, content, etc...) and I would need a callback on success with this information.
Have you made any progress on this since @rayj10 ?
Mailer.mail({
subject: 'need help',
recipients: ['[email protected]'],
ccRecipients: [],
bccRecipients: [],
body: '<b>A test body</b>',
isHTML: true,
attachment: {
path: '', // The absolute path of the file from which to read data.
type: '', // Mime Type: jpg, png, doc, ppt, html, pdf, csv
name: '', // Optional: Custom filename for attachment
}
}, (err, event) => {
console.log(err, event);
});
The email is sent successfully, but I can not get callback (err, event)