flutter_email_sender icon indicating copy to clipboard operation
flutter_email_sender copied to clipboard

Multiple attachements paths make the body disappear (Android)

Open TBG-FR opened this issue 4 years ago • 8 comments

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 ?

TBG-FR avatar Mar 16 '21 00:03 TBG-FR

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.

t-pi avatar Apr 28 '21 23:04 t-pi

I'm seeing this exact behavior as well. Works fine on ios.

amitkot avatar May 04 '21 06:05 amitkot

Seeing this on 5.0.0 on Android (not tested on IOS)

SRadfordM avatar Jun 15 '21 14:06 SRadfordM

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 avatar Jun 27 '21 08:06 petrblahos

@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)

zuzi-m avatar Jul 01 '21 09:07 zuzi-m

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

zuzi-m avatar Jul 07 '21 08:07 zuzi-m

With isHTML:true no attachments are added :(

Mmisiek avatar Oct 06 '21 16:10 Mmisiek

I take it back, using GMAIL even single attachment is not working :(

Mmisiek avatar Oct 06 '21 16:10 Mmisiek

Using a recent version (5.1.0) and gmail, everything seems to work fine (with one or multiple attachments, body is always there)

TBG-FR avatar Oct 27 '22 09:10 TBG-FR