---
title: "How to send Base64 images in Gmail with Google Apps Script"
author: "Martin Hawksey"
date: 2023-10-30T23:14:05+00:00
canonical_url: https://pulse.appsscript.info/p/2023/10/how-to-send-base64-images-in-gmail-with-google-apps-script/
markdown_url: https://pulse.appsscript.info/p/2023/10/how-to-send-base64-images-in-gmail-with-google-apps-script.md
categories:
  - "Gmail"
  - "Intermediate"
  - "Snippet"
tags:
  - "@labnol"
  - "labnol.org"
featured_image: https://pulse.appsscript.info/files/2023/10/SG93IHRvIFNlbmQgQmFzZTY0IEltYWdlcyBpbiBFbWFpbCB3aXRoIEdvb2dsZSBBcHBzIFNjcmlwdA.iInO1i_Xi9qpF9ril8QVFuXQ033pyz_GzvvfJSG5OfQ.png
description: "Base64 is a way of encoding binary data (like images) as a string of text. This makes it possible to embed images in webpages and HTML emails without hosting images on a server. An issue however, particularly for email, is that not all email services like Gmail support base64 encoded images. Amit Agarwal's latest blog post discusses a workaround for Gmail which involves using Google Apps Script to convert the base64 images to a blob and then embedding the blob in the email. There are some nice techniques in this post for handling/searching text strings with regular expressions as well as converting them to a Gmail friendly format."
---

# How to send Base64 images in Gmail with Google Apps Script

![How to send Base64 images in Gmail with Google Apps Script](https://pulse.appsscript.info/files/2023/10/SG93IHRvIFNlbmQgQmFzZTY0IEltYWdlcyBpbiBFbWFpbCB3aXRoIEdvb2dsZSBBcHBzIFNjcmlwdA.iInO1i_Xi9qpF9ril8QVFuXQ033pyz_GzvvfJSG5OfQ.png)

> [https://www.labnol.org/gmail-base64-images-231026](https://www.labnol.org/gmail-base64-images-231026)
> Gmail will not render base64 images embedded inside HTML emails but with Google Apps Script, you can use blobs to send the base64 encoded images

Base64 is a way of encoding binary data (like images) as a string of text. This makes it possible to embed images in webpages and HTML emails without hosting images on a server. An issue however, particularly for email, is that not all email services like Gmail support base64 encoded images.

Amit Agarwal’s latest blog post discusses a workaround for Gmail which involves using Google Apps Script to convert the base64 images to a blob and then embedding the blob in the email. There are some nice techniques in this post for handling/searching text strings with regular expressions as well as converting them to a Gmail friendly format.

Source: *[How to Send Base64 Images in Email with Google Apps Script – Digital Inspiration*](https://www.labnol.org/gmail-base64-images-231026)

---

*Published by [Martin Hawksey](https://pulse.appsscript.info/p/author/admin/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2023/10/how-to-send-base64-images-in-gmail-with-google-apps-script/](https://pulse.appsscript.info/p/2023/10/how-to-send-base64-images-in-gmail-with-google-apps-script/)*
