1

I send email like HTML with option IsBodyHtml = true.

var msg = new MailMessage(fromEmail, firstEmail, email.Subject, bodyText)
{
    IsBodyHtml = true
};

Where bodyText is TinyMCE editor parsed HTML that looks absolutly fine.

When I get email I see a normal formatted HTML and image like this one

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4Ug8RXhpZgAATU0AKgAAAAgABwALAAIAAAAmAAAIbgESAAMAAAABAAEAAAExAAIAAAAmAAAIlAEyAAIAAAAUAAAIuodpAAQAAAABAAAIzoglAAQAAAABAAARJuocAAcAAAgMAAAAYgAAIaYc6gAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ..... and etc ...." >

So it seems like the image which has base64 source wasn't encoded properly at all.

Please, help to fix it.

Thanks!

UPDATE #1 In Gmail it looks like this enter image description here

In the database it looks like enter image description here

NoWar
  • 36,338
  • 80
  • 323
  • 498
  • It's not a problem displaying a base64 image, it's the "base64 image" itself being incomplete. Try this base64-encoded image element that I just created ([pastebin](https://pastebin.com/AyQYxNmf)). – ProgrammingLlama Jan 10 '20 at 08:37
  • @John_ReinstateMonica It is an example only in my question. I mean the `img` is cutted. I get saved parsed html of TinyMCE from a database. And image is absolutly fine it is possible to see it. – NoWar Jan 10 '20 at 08:39
  • What do you mean cut? It's hard to visualise what you mean. Do you mean part of it is missing when it's rendered? – ProgrammingLlama Jan 10 '20 at 08:41
  • @John_ReinstateMonica I mean instead of a normal image in my google email I see a RAW Data of the `img` tag. But the image is ok because in edit mode loads fine in TinyMCE. – NoWar Jan 10 '20 at 08:45
  • @Developer Is the mail client capable of displaying images from base64? – Andrew Morton Jan 10 '20 at 08:45
  • @AndrewMorton Sure, it is a google mail. – NoWar Jan 10 '20 at 08:46
  • If you're seeing the actual HTML tags then it seems to me you have encoded your HTML such that the tags have become < and >. – ProgrammingLlama Jan 10 '20 at 08:47
  • @John_ReinstateMonica Do you mean I have to decode the whole HTML before to create `MailMessage` ? – NoWar Jan 10 '20 at 08:53
  • In the database it looks OK, which is odd. You might want to click the three dot hamburger menu thing on the right-side of the e-mail in Gmail and click "show original" (though you may have to decode this from base64 to see the HTML) in order to find out how it was received. – ProgrammingLlama Jan 10 '20 at 08:57

1 Answers1

1

https://www.google.com/search?q=does+gmail+display+base64&rlz=1C1GCEU_ruRU819RU819&oq=does+gmail+display+base64&aqs=chrome..69i57j33.6352j0j7&sourceid=chrome&ie=UTF-8

2 Answers. base64 encoded images are not well supported in email. They aren't supported in most web email clients (including Gmail) and are completely blocked in Outlook. Apple Mail is one of the few clients that does support them, that's why you're able to see them there but not elsewhere.Nov 18, 2019

NoWar
  • 36,338
  • 80
  • 323
  • 498