How to Send Base64 Images in Email with Google Apps Script
Base64-encoded images can be embedded directly inside HTML emails without having to host the image on a remote server. This offers several advantages: Avoids tracking - External images are often used by email marketers to track email opens . Reduced spam potential - Some email servers may reject emails that contain external images. No broken images - If the image is hosted on a remote server, it may not load if the server is down. Gmail, however, does not support base64 images in HTML emails. If you try to send an email with base64 images to a Gmail or Google Workspace account, the image will not be displayed in the email body but will be displayed as an attachment instead. The workaround is to convert the base64 image to a blob and then embed the blob in the email. We use a similar technique to embed base64 encoded images in emails sent from Mail Merge and Document Studio . The following Google Apps Script function will convert all base64 images in an HTML email to blobs and ...