Improve Email Deliverability: A Comprehensive Guide to Embedded Images, Attachments, and Code

Do your beautifully designed HTML emails fall flat when images show up broken or fail to load in the recipient’s inbox? Avoid the frustration with this comprehensive guide to expertly including images, attachments, and custom code in your campaigns.
We’ll explore image blocking, formatting, hosting, troubleshooting clients like Outlook and Gmail, maximizing deliverability, and more. Follow these best practices and your readers will enjoy seamless images that make emails pop.

Why Do Email Images Appear Broken or Fail to Load?

Including images in your email campaigns can be a great way to increase engagement and communicate your message visually. However, you may occasionally run into issues where the images seem broken, don’t appear at all, or fail to load properly on the recipient’s end. Frustratingly, your email might look perfect in your inbox but then have problems in other email clients.
There are a few key reasons why email images can break, which we’ll explore in more detail:

Image Blocking in Gmail and Outlook

Two of the most common email services, Gmail and Outlook, will automatically block images in emails by default as a security precaution. This prevents unknown senders from tracking whether their emails are opened through remote image URLs.

Gmail doesn’t show images for external content in the default view. Recipients have to actively click ‘Load Images’ to enable them. Outlook blocks images in emails from new or unverified senders by default as well. So even though you diligently inserted images and tested your emails, many recipients won’t see them.

To avoid this image blocking, you can:

  • Use services like Mystrika to properly warm up and verify your sending domains and IP addresses. This increases trust and bypass filters.
  • Host images on reputable, secure domains like Google Drive or Amazon S3 instead of your own server.
  • Insert images after the first few sentences of text content, so the email preview shows enough text to entice recipients to load images.
  • Educate recipients to add your address to their contacts so images aren’t blocked.

MIME Type Mismatch

MIME types tell email clients what type of content an attached file contains – like images, PDFs, documents etc. Issues can arise if the MIME type declared in the email code doesn’t match the actual attached file.

For example, if you attach an image labeled as MIME type text/html instead of image/jpeg, the email client won’t recognize there’s an image present and nothing will display. Using incorrect MIME types is easy to do by accident.

To avoid this:

Image FormatCorrect MIME Type
JPGimage/jpeg
PNGimage/png
GIF image/gif
TIFF image/tiff
Table: Common image MIME types

Using Absolute Paths Instead of CIDs

Embedded images in HTML emails can be referenced in the <img> tag either through an absolute URL path like http://www.example.com/images/image.jpg or through a unique Content-ID defined in the email header like <img src=”cid:unique1234″>.

Using Content-ID references generally works better across different email clients. Referencing images through absolute URLs can break images in some mobile and webmail programs. The image looks locally on your computer but then doesn’t load when received.

To avoid this:

  • Favor using CIDs over absolute paths when inserting images.
  • Test your campaigns before sending to ensure images display properly.
  • Consider hosting images externally on sites like Imgur and referencing them by URL if you don’t control the sender domain.

Issues with Image Encoding

Images attached directly to emails should use base64 encoding to ensure proper transmission. Base64 converts binary data like images into plain ASCII text so it can safely pass through email servers.

If an image isn’t properly base64 encoded, the recipient’s email client won’t be able to decode and display it – again leading to broken images.

Luckily, this issue is relatively rare these days as most email services automatically encode attachments. But it can still sometimes occur if you’re manually building emails without the proper encoding.

You can manually encode images using sites like Base64.Guru before attaching them. But unless required for a special use case, it’s generally better to let your email service handle the encoding behind the scenes.

Hopefully this gives you a better understanding of some of the common pitfalls that can break images in HTML emails and prevent them from loading properly for recipients. With mindful design and extensive testing, you can master the art of including images in your email campaigns without issue. Services like Mystrika also offer robust deliverability features to help images consistently show for your readers.

Embedding Images in HTML Emails

Once you’ve got your email content drafted, it’s time for the fun part – adding images! Images can really take your email campaigns to the next level visually. But embedding images properly in HTML emails does require some special considerations.
In this section, we’ll explore best practices for including images in the HTML source of your emails to ensure proper delivery and display across clients.

Using the IMG Tag with CID References

The basic HTML tag for displaying an image is <img>. To embed an image in an email, you’ll use code like:

<img src="cid:image1234">

Here some key tips for using the IMG tag in emails:

  • Reference images using their Content-ID (cid:) rather than an absolute URL path. CID links are more reliable across different email clients.
  • Define each CID reference in the email header like:
Content-ID: <image1234>  
  • Host images externally on a reliable CDN or hosting provider rather than attaching directly. This improves deliverability.
  • Include height and width attributes on the IMG tag so the image space is reserved even if blocked initially.
  • Use alt text that describes the image for accessibility and context if it fails to load.

So putting it together in a full email with an external hoted image, it would look like:

Content-Type: multipart/related; boundary="boundary" 

--boundary
Content-Type: text/html; charset="UTF-8"

<img src="cid:image1234" width="500" height="300" alt="Company Logo">

<p>Hello World!</p>

--boundary
Content-ID: <image1234>
Content-Type: image/png

http://external.host.com/images/image.png

This provides the framework to reliably include images in your HTML email source.

Adding Background Images to Table Cells

In addition to standard IMGs, you can also define background images on table cells and other elements in HTML emails. This is done using inline CSS styles like:

<td style="background: url(cid:bgimage1234)">
</td> 

Background images can be a great way to add visual flair while keeping your email content flexible and responsive.

Some tips when using background images:

  • Pay attention to image sizing – background images may distort if the cell size varies across email clients.
  • Include padding to prevent overlapping text content.
  • Define width and height for the cell to reserve spacing.
  • Use background colors as a fallback if the image fails to load.

Inline CSS for Responsive Image Sizing

Email clients have varying levels of CSS support. To ensure images display properly regardless of the client, it’s best to use inline CSS styles rather than external or embedded CSS.

For responsive image sizing, you can use code like:

html <img src="cid:image123" width="100%" style="max-width:500px;">

This allows the image to scale down if needed while capping it at a maximum of 500px wide.

Other useful inline styles include:

  • display:block; – Images default to inline. Setting to block prevents other content from flowing beside it.
  • border:none; – Remove borders that some clients add by default.
  • overflow:hidden; – Prevents overflow on small screens.

Choosing the Right Image Formats

For maximum compatibility, JPEG and PNG are the best image formats to use in HTML emails.

  • Use JPEG for photos and complex images. It has great compression but can show artifacts around sharp edges if very compressed.
  • Use PNG for logos, illustrations, and images with solid blocks of color. PNGs retain hard edges better.

Other considerations when selecting image formats:

  • JPEG 2000 and TIFF files are too large for email.
  • GIFs can work but animate in some clients. Use sparingly.
  • BMP images are very large and lack broad support. Avoid if possible.
  • SVG vector formats don’t display consistently across email clients.
Image TypeRecommended Use
JPEG Photos
PNG Logos, Illustrations
GIF Animations (Limited)
Table: Best practices for image formats in HTML emails

Following these tips and best practices for adding both standard and background images to your HTML emails will help ensure your recipients see them rendered properly, regardless of their email client. Well-formatted images make for engaging, visually appealing email campaigns.

Sending Attachments in Emails

In addition to embedding images directly in the HTML, you may also need to send file attachments like documents, PDFs, or larger images.
Attaching files to emails has some key differences from inline content. Follow these best practices for smooth delivery and display of your attachments.

Attachment Size Limits

Most email providers impose limits on maximum attachment sizes. For example:

  • Gmail – 25MB per attachment
  • Outlook – 20MB per attachment
  • Yahoo – 25MB per message

Exceeding these limits will cause the entire email to bounce rather than just the oversized attachment being rejected.

To avoid this:

  • Keep individual attachments under 20-25MB if possible.
  • Resize large images before sending.
  • Split larger files like videos into multiple smaller attachments.
  • Use file compression tools to reduce size if needed.
  • Provide links to download very large files from a server.

Also be aware that some mobile devices and older clients have more restrictive limits like 5-10MB for email attachments.

Using the Content-Disposition Header

Attachments require the Content-Disposition header to be properly identified as a file rather than displayed inline.

This header will contain the filename like:

Content-Disposition: attachment; filename="document.pdf"

The email client uses this to display the actual file name rather than just the MIME type.

Additional tips when attaching files:

  • Specify both Content-Disposition and Content-Type for each attachment.
  • Consider using Content-ID as well to embed attachments into the body content.
  • Verify attachments open correctly after delivery to check for encoding issues.

Inline Images vs. Regular Attachments

Sometimes it’s unclear whether a given file should be an inline embedded image or a standard attachment.

  • Inline images display directly in the message body and need to be referenced via CID.
  • Standard attachments are accessed through an open/save prompt and require Content-Disposition.

Considerations for inline vs attachment:

  • Inline images keep the message contained, but can bloat size and impact deliverability.
  • Users have to manually save attachments, but email body remains clean.
  • For larger files like PDFs, attachments are generally better than embedding inline.
  • For core message images, use inline embedding so they display properly formatted.

Embedding Attachments Into the Email Body

Rather than basic links to download, you can embed attachment files directly into the HTML email body as well. This displays the attachment for inline viewing rather than needing to open it.

For example:

<div>
  <object data="cid:reportdoc1234" 
    type="application/pdf" 
    width="100%" 
    height="500px">
  </object>
</div>

Some considerations with this approach:

  • Won’t work for all file types depending on client support.
  • Ensure width and height are defined for the object tag.
  • Falls back to a download link if the object can’t be displayed inline.
  • Can present accessibility and compatibility issues depending on format.
  • Use sparingly and test thoroughly across clients.

Handling attachments in emails does require some special considerations like sizing limits and displaying file names properly. With testing and proper headers, you can successfully share documents, PDFs, and large images without delivery issues.

Avoiding Spam Filters and Maximizing Deliverability

Getting your image-enabled emails to the recipient’s inbox rather than caught as spam is critical.
Use these best practices to maximize deliverability and avoid extra scrutiny from spam filters when sending HTML emails with images.

Warming Up New Email Addresses

If you send mail using a brand new email address or domain name, many recipients will flag your messages as risky or spam.

To increase trust and avoid extra filtering, properly warm up any new sending domains by:

  • Send a limited volume of emails at first, then gradually increase it. Start with 50-100 emails per day.
  • Make sure DNS, SPF, DKIM, and DMARC are configured properly for your domain. This verifies you as the real sender.
  • Send non-commercial content like mailing list sign up confirmations from the domain at first. Transactional mail gets less scrutiny.
  • Use services like Mystrika to automatically warm up new addresses with legitimate seed traffic.

Taking 2-4 weeks to ramp up email volume from a new domain signals to receivers that you are legitimately established rather than a fly-by-night spam operation. Following warmup best practices helps your future emails reliably land in the inbox.

Hosting Images on Reputable Domains

In addition to warming up the sending domain, also consider where your images are hosted. Images loaded from unusual or unknown sites are more likely to be blocked.

When possible, use image hosting from established providers:

  • Google Drive
  • Imgur
  • Amazon S3
  • Microsoft Azure

This prevents images from being flagged as risky, blocked or filtered by clients.

Additionally, enable SSL encryption so images are loaded securely over https://. Unencrypted http:// image requests will cause warnings in many email apps.

Balancing Image File Size

The total size of images in your HTML emails also impacts deliverability. Images bloat the message size, which raises spam suspicion and risks going over recipient limits.

  • For regular email content, try to keep total images under 300-400KB.
  • Highly designed campaigns and ecommerce promotions may run larger around 600KB.
  • Use compression to minimize image file sizes without noticeably reducing quality.
  • Load larger images like product photos lazily after page scroll rather than directly embedded.

Finding the right balance results in fast loading email content while still allowing beautiful images that engage your recipients.

Using ALT Text Properly

All <img> tags in HTML should have descriptive and relevant alt text. This displays if the image fails to load and also helps email clients determine context.

Poor or missing alt text raises spam flags. Avoid:

  • No alt text at all
  • Generic labels like “photo” or “image”
  • Unrelated keywords for SEO
  • Duplicating the surrounding content
  • Overly promotional language

Well-written, contextual alt text helps prove your images have a legitimate purpose and aren’t spammy bait images.

Checking Blacklists Regularly

Occasionally email servers or IP addresses end up wrongly flagged and listed on spam blacklists like Spamhaus or Blocklist.de. This instantly blocks your mail.

Routinely check your domain and server IPs against common blacklist databases using tools like MXToolbox.

If blacklisted, you’ll need to delist the IP/domain through the blacklist provider’s published process. This can take 1-2 weeks depending on their policies.

Monitoring Bounce Rates

High bounce rates signal issues to receiving servers. Your domain or sending IP may be temporarily throttled or blocked if excessive bounces occur.

Aim to keep hard bounce rates below 2% if possible by:

  • Accurately validating and scrubbing your mailing lists.
  • Avoiding spam traps and honeypot addresses.
  • Properly handling opt-outs and unsubscribes.

Services like Mystrika provide bounce processing and notifications to list owners so issues can be addressed before major problems emerge.

Limiting Image-Heavy Emails

While images are great for engagement, be cautious about sending very image-heavy emails too frequently.

Bulk image content slows loading, bloats size, and may appear like eye-catching spam bait if overdone.

  • Limit image-focused emails to important promotions or special announcements so they retain impact.
  • Otherwise intersperse image-free information, content, and product emails as well.
  • Test that your images display properly even on slow connections like mobile to avoid blank-looking mails.

Exercising restraint prevents recipients from tuning out image-heavy emails if they become too commonplace. Reserve for when you really need high visual impact.

Carefully warming up domains, optimizing images, and monitoring bounce rates allows you to maximize deliverability for image-enabled HTML email campaigns. Follow these guidelines and your recipients will be engaged by well-formatted images rather than missing them entirely in the spam folder.

Troubleshooting Image Issues in Common Email Clients

Despite your best efforts, sometimes images still won’t display properly for all recipients. Let’s go over some troubleshooting tips for fixing image problems in the most popular email apps.

Fixing Image Problems in Gmail

As mentioned earlier, Gmail blocks images in emails from unfamiliar senders by default. Recipients have to manually enable images for each message.

To ensure your images consistently show for Gmail users:

  • Request readers add your address to their contacts which whitelists you.
  • Use good warmup practices so Gmail recognizes you as an established sender.
  • Host images on domains Gmail trusts like Google Drive or Imgur.
  • Make sure images are sized appropriately and compress any unnecessarily large files.
  • Insert a text callout in the body content prompting readers to enable images if blocked.

With proper habits, your images should display automatically for most Gmail users over time.

Enabling Images in Outlook

Similar to Gmail, Outlook also blocks external content like images in emails from new or unverified senders.

To allow images in Outlook:

  • As the recipient, right click the blocked image placeholder and select Download Pictures.
  • Or go to Message > View > Show Pictures in the Outlook menu.
  • Add trusted senders like your domain as contacts or safe senders to automatically allow images.
  • On Outlook webmail, select Always show images from this sender.

Educating your Outlook-using subscribers on enabling images ensures they see your emails as intended.

Image Display on Android Phones

On Android mobile devices, email images may fail to load when using data saver mode or restrictive bandwidth options.

To troubleshoot image issues on Android:

  • Disable battery optimization for your email app – this can prevent background image downloads.
  • Check if Data Saver or Low Bandwidth modes are enabled in the app or system settings and turn them off.
  • Connect to WiFi or allow the email app unrestricted data usage to automatically download full images over cellular data.
  • Some apps like Gmail also have a Download Externals setting which needs to be enabled.

iOS Default Image Blocking

Apple iOS for iPhone and iPad blocks external images in emails by default, with no option for recipients to enable them per message like on other platforms.

To allow images on iOS devices:

  • Senders need to be in the recipient’s contacts for images to load automatically from the sender’s domain.
  • iOS users can enable images globally in Settings > Mail > Load Remote Images.
  • The workaround is to host images on popular external domains like Imgur that iOS allows regardless of sender.
  • You can also educate recipients to add your address as a contact to ensure images load.

Understanding the quirks of each major email client helps diagnose and resolve image loading issues your subscribers may experience. With testing and troubleshooting, you can configure image-enabled emails that display perfectly across all platforms.

Tools and Best Practices for Managing Email Images

Sending great looking emails with embedded images at scale requires the right tools and workflows. Let’s explore some recommendations for managing your email imagery effectively.

Using a Service like Mystrika for Deliverability

Rather than building and sending customized image-enabled emails directly from your own server, consider leveraging a specialized third-party email service.

Tools like Mystrika provide many benefits:

  • Built-in image hosting from trusted domains for better deliverability.
  • Automated image compression and optimization during send.
  • Dedicated IP warming and domain authentication to bypass filters.
  • Detailed analytics on image opens, clicks, and performance.
  • A/B testing for subject lines, content, and images.
  • Flexible APIs and integrations with leading platforms.
  • Scalable infrastructure designed for email vs DIY setups.

Unless email is a core competency, outsourcing campaign sending to reliable delivery experts is recommended.

Generating Image URLs with Tracking

When hosting images yourself, dynamically generate unique URLs for each image that allow tracking analytics.

For example:

http://domain.com/track/email/image.jpg?id=123&userid=456

Use query parameters to associate the image to a particular campaign, message, and recipient for monitoring performance.

Then use this dynamic URL in the email <img src=> rather than a static file location.

Converting Images to HTML Entities

For very simple images like icons, consider encoding the raw pixel data directly into HTML entities rather than linking out to a file.

This avoids extra HTTP requests and ensures the image appears regardless of client or external blocking.

For example:

Renders as:

✉️

Useful for basic shapes, icons, logos, and illustrations. Avoid for complex or photographic images.

Compressing Images Before Sending

As mentioned earlier, image file size has a big impact on email deliverability.

Use compression tools to minimize image kilobyte sizes without noticeably reducing quality:

  • TinyPNG
  • JPEGmini
  • ImageOptim

These can compress JPG, PNG, SVG, and GIF formats effectively.

Reduce overall email size and load times for recipients by compressing properly before upload.

Testing Rendering Across Different Clients

No matter what service or tool you use to create and send image emails, always test extensively first:

  • Use Litmus, Email on Acid, or similar rendering testers.
  • Forward test messages to accounts on the major webmail, desktop, and mobile apps.
  • Check image blocking, load times, formatting, links, and spacing.
  • Adjust image widths/heights, compression, and CID references as needed.

Testing thoroughly across email clients, devices, and networks helps perfect the formatting and presentation – ensuring your hard work on images pays off for every recipient every time.

Leveraging the right tools and technologies allows delivering well-designed image emails at scale, while optimizing and tracking performance. Services like Mystrika combined with disciplined testing processes give you added firepower to get your visual messages looking amazing in all scenarios.

Frequently Asked Questions

Why are my images not showing up in some emails?
The most likely culprit is image blocking by the recipient’s email client, like Gmail or Outlook. Enable contact permissions for the sender, switch to a universal image-allowing client, or manually enable images per email to see them.

How can I make sure images send properly on mobile?

Closely check image sizing, formatting, and CID references to ensure they display well on small screens. Disable “Data Saver” type modes that may block images. Consider hosting images on mobile-friendly services like Imgur.

What is the maximum size for email attachments?

Most providers limit individual attachments to 25MB or less. Total message size can be around 35MB. Exceeding these thresholds risks automatic rejection or delivery issues.

Is it better to embed images or attach them?

For core message graphics, use inline HTML image embeds. For larger files like documents, PDFs, or high-res photos, use attachments and link to them in the body content.

How can I track opens and clicks for images?

Use a service like Mystrika that supports tracked image URLs with analytics. Or host images yourself and dynamically generate unique image URLs with campaign parameters.

What is the best image format for email?

JPEG is ideal for photographic images. PNG is better for logos, illustrations, and images with text/lines. GIF works for animated images. Avoid heavy formats like BMP and TIFF.

Why not just use image URLs instead of CIDs?

External image URLs are prone to blocking in many clients. CID links to attachments stored in the email payload work more reliably across different platforms.

How can I reduce image file sizes without quality loss?

Use compression tools like TinyPNG to minimize JPEG/PNG file sizes. This shrinks image data volume without noticeably reducing image quality.

What is the proper way to write ALT text?

ALT text should briefly describe the image content or context. Avoid overly promotional/salesy language. Leave blank for purely decorative images.