On Mon, 11/23/2026 11:01 PM, T wrote:
> On 11/23/26 17:38, dillinger wrote:
>> Instead of file:///home/temp/confetti2.png, you can also use an image
>> located somewhere on the internet (e.g.,https://my.site/confetti2.png).
>
> When I sent the test to me, it could not find the file on
> my local drive. So, putting a public url would not help.
>
> And I did check the source on the email that did come back.
> It was verbatim of what I sent.
>
> file:///home/temp/confetti2.png exists on my drive.
Can you get the AI to write one of these for you ?
It must know the right tricks.
This is too hard for me :-) Help, help, Ai, save us.
OK, here we go on a roller coaster ride.
******* CoPilot Question *******
If you were writing an HTML email with a non-repeating BASE64 embedded
background image in it, what code would you use (style, body, and so on) ?
The code should survive transmission through gmail (which apparently
can modify HTML email).
******* CoPilot Answer ********
If your requirement is specifically:
"HTML email + non-repeating background image + Gmail-compatible + survives
transmission through Gmail"
then the first thing to know is that Base64 (data:image/...;base64,...)
background images are not a good choice. Gmail's sanitization commonly strips
or blocks data URIs in email HTML, and support across mail clients is poor.
Gmail webmail in particular does not reliably render Base64-embedded images.
For maximum compatibility, email developers typically:
Host the image on HTTPS.
Use a table-based layout.
Apply the background image to a <td> via inline CSS.
Specify background-repeat:no-repeat.
Include a solid fallback background-color.
A Gmail-friendly pattern looks like:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Email</title>
</head>
<body style="margin:0;padding:0;">
<table
role="presentation"
cellpadding="0"
cellspacing="0"
border="0"
width="100%">
<tr>
<td
align="center"
bgcolor="#ffffff"
background="https://example.com/background.jpg"
style="
background-image:url('https://example.com/background.jpg');
background-repeat:no-repeat;
background-position:center top;
background-size:cover;
margin:0;
padding:0;
">
<table
role="presentation"
cellpadding="0"
cellspacing="0"
border="0"
width="600">
<tr>
<td style="padding:40px;">
<h1 style="margin:0;font-family:Arial,sans-serif;">
Hello
</h1>
<p style="font-family:Arial,sans-serif;">
Email content here.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
If you absolutely insist on Base64, the syntax would be:
<td style="
background-image:url(data:image/png;base64,iVBORw0KGgoAAA...);
background-repeat:no-repeat;
background-position:center top;
">
but you should expect Gmail to remove or ignore it.
For modern Gmail, a more robust approach is:
<td
background="https://example.com/bg.png"
style="
background:url('https://example.com/bg.png') no-repeat center top;
background-size:100% auto;
">
A few additional email-specific notes:
Put CSS inline rather than in <style> blocks whenever possible.
Use tables, not flexbox/grid.
Do not rely on CSS classes surviving; Gmail may rewrite HTML.
Keep the entire message under Gmail's clipping threshold (~102 KB of HTML)
because large Base64 strings can cause clipping. If the image must travel
with the message and not be fetched remotely, use a MIME CID attachment
(src="cid:...") rather than Base64 in the HTML. CID images generally
survive Gmail and Outlook much better.
So the practical answer is: there is no Base64 background-image solution
that can be recommended as Gmail-safe. If Gmail compatibility matters,
use a hosted HTTPS image (best) or a CID-attached image.
If you ever need to support Outlook desktop (Windows) as well, there is a
whole additional layer involving VML (<v:rect> and <v:fill>) background-image
fallbacks. The resulting code is admittedly ugly, but it's the closest
thing to a "works everywhere" solution for email backgrounds.
******* End: CoPilot Answer *******
Paul