flutter_email_sender
flutter_email_sender copied to clipboard
Multiple attachements paths make the body disappear (Android)
Using flutter_email_sender: 4.0.0, I noticed a bug in Android : if I add multiple files path when instanciating an Email object, the body is not taken into account anymore. The Mail app used is GMail.
With the following code, I get an email with the body and one file
final Email email = Email(
body: 'Here you go, find the files enclosed',
subject: 'Exporting files',
recipients: emails,
attachmentPaths: ['workZip.path'],
isHTML: false,
);
With the following code, I get an email with two files but no more body
final Email email = Email(
body: 'Here you go, find the files enclosed',
subject: 'Exporting files',
recipients: emails,
attachmentPaths: ['workZip.path, info.csv'],
isHTML: false,
);
Are you able to reproduce it ? Any ideas on what is happening there ?
Yes, just ran into the same behavior - thanks for documenting :)
Single attachment -> everything's fine
Multiple attachments -> attachments show in the mail, but no body. body is available (print... 🙄) just prior to invoking send.
I'm seeing this exact behavior as well. Works fine on ios.
Seeing this on 5.0.0 on Android (not tested on IOS)
I tried this small change and it seems to work well both for multiple attachments and for a single one:
https://github.com/petrblahos/flutter_email_sender/commit/4da0b914f9fe45fa98a875ca1c616d2bc5eb66d0
I haven't tried html body though.
Can somebody comment on why intent.putCharSequenceArrayListExtra was used and not just intent.putExtra?
@petrblahos thanks for spotting the mistake :) I believe your fix is correct and I have verified with a simple test that it fixes it
I have opened a pull request with this change so it could be easily merged #75 (also includes some small refactors)
The author now published version 5.0.2 where this problem should be fixed. Can the author of this issue @TBG-FR please confirm the issue as fixed and close the issue if it works correctly? Thanks
With isHTML:true no attachments are added :(
I take it back, using GMAIL even single attachment is not working :(
Using a recent version (5.1.0) and gmail, everything seems to work fine (with one or multiple attachments, body is always there)