Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gmail: Image not display #133

Closed
GaetanFauconnier85 opened this issue Jan 29, 2020 · 5 comments
Closed

Gmail: Image not display #133

GaetanFauconnier85 opened this issue Jan 29, 2020 · 5 comments

Comments

@GaetanFauconnier85
Copy link

GaetanFauconnier85 commented Jan 29, 2020

I want to write an email with a image.
The email is send but when i open it the image is blanck.
Did i mis something ? And other question, how can i attache image ?
Thanks
Best regards

`

Uint8List qr = await _generateBarCode(element.idDiscount);
      print(qr);
      var image = BASE64.base64Encode(qr);
      print(image);
final smtpServer = gmail('**','**);
print(emailUser);
final message = Message()
..from = Address('***')
..recipients.add(emailUser) //recipent email
..subject = "oui"
..html = "<div> <p>Taken from wikpedia</p> <img src=\"data:image/png;base64, $image\" alt=\"Logo\" title=\"Logo\" style=\"display:block\" width=\"200\" height=\"87\" />";


try {
final sendReport = await send(message, smtpServer);
print('Message sent: ' +
sendReport.toString()); //print if the email is sent
} on MailerException catch (e) {
print('Message not sent. \n' +
e.toString()); //print if the email is not sent
// e.toString() will show why the email is not sending
}`

image

@close2
Copy link
Collaborator

close2 commented Jan 30, 2020

Please send me this email: [email protected]
I'll take a look.

Have you seen
#85 and
#104
?

@GaetanFauconnier85
Copy link
Author

GaetanFauconnier85 commented Jan 30, 2020 via email

@close2
Copy link
Collaborator

close2 commented Jan 30, 2020

If I understand correctly your images are in base64.
A lot of mail programs don't display them.

Try inline attachments.

I've used this:
<img alt="Bewerbung" height="auto" src="cid:[email protected]" style="border:none;display:block;outline:none;text-decoration:none;height:auto;width:100%;" width="100">
in one of my mails.
(I've created the mail using mjml, which I highly recommend: https://mjml.io/try-it-live)

The image was then added (in dart) like this:
FileAttachment(File(a)) ..location = Location.inline ..cid = "<[email protected]>")

Note that the cid in the code has additional < and >

I can send you more details if you want (just send me an email).

@close2 close2 closed this as completed Jan 30, 2020
@GaetanFauconnier85
Copy link
Author

GaetanFauconnier85 commented Jan 30, 2020 via email

@Harshana-Rathnayaka
Copy link

If I understand correctly your images are in base64.
A lot of mail programs don't display them.

Try inline attachments.

I've used this:
<img alt="Bewerbung" height="auto" src="cid:[email protected]" style="border:none;display:block;outline:none;text-decoration:none;height:auto;width:100%;" width="100">
in one of my mails.
(I've created the mail using mjml, which I highly recommend: https://mjml.io/try-it-live)

The image was then added (in dart) like this:
FileAttachment(File(a)) ..location = Location.inline ..cid = "<[email protected]>")

Note that the cid in the code has additional < and >

I can send you more details if you want (just send me an email).

Hey, I'm facing the same issue. My image is base64 and it's not displayed in the email. Also I checked inspect element. And there was no src property. I don't understand why.

Also in your code
FileAttachment(File(a))

Where do you declare this variable a and how do you declare it? As a File ? If it's a File how do you assign the image to it? Sorry I'm a newbie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants