Trying to embed pictures in your emails? You’ve come to the appropriate place.
It’s good to boost your advertising and marketing or transactional emails with a number of pictures every so often. Even when it’s only a emblem, you’ll discover it helps so as to add a contact of legitimacy to what you ship out.
Nevertheless, there’s no one manner to do that. Do you hyperlink out to the picture on a CDN? Do you embed it and reference it by way of a CID tag? Perhaps as a linked picture? Which one must you select?
On this put up, we’ll present you methods to embed a picture in an electronic mail with all these choices—plus, we’ll handle the professionals and cons of every. For Twilio SendGrid customers, we’ll present you the way you’d use these choices with SendGrid, so you may have a look at your wants and your viewers and make up your thoughts.
Let’s begin with the mysterious CID.
3 methods to embed pictures in emails
1. CID embedded pictures (inline pictures)
To me, CID (or Content material-ID) feels outdated, and one thing very akin to working with emails in Outlook. That apart, it’s nonetheless an choice, and we help it in our shopper libraries.
CID pictures work by attaching the picture to the e-mail you ship after which utilizing commonplace HTML picture tags that reference that picture to finally embed it within the electronic mail when the person opens it.
Utilizing the SendGrid Node.js shopper library, we’d connect the picture like so:
var params = {
smtpapi: new sengrid.SmtpapiHeaders(),
... //some vars eliminated right here!
recordsdata: [
Buffer)
],
file_data: {},
headers: {}
};
Then, in your HTML template, you’d embed the picture on this manner:
<html>
<physique>
<img src="cid:myimagecid"/>
</physique>
</html>
Wow, proper? No.
The issue with CID embedded pictures is that they don’t all the time show correctly in electronic mail purchasers. The rule of thumb is that CID embedding will work wonderful in most desktop electronic mail purchasers, however more than likely in no way in web-based electronic mail purchasers, corresponding to Gmail or Yahoo! Mail.
Bummer.
Execs of CID pictures
- It’s been round for a very long time
- Its utilization ensures the right mime-type of multipart/associated
- It’s supported by way of our shopper libs
Cons of CID pictures
- Will increase the dimensions of total electronic mail
- Varies in outcomes throughout electronic mail purchasers, particularly webmail
- Feels outdated
- Requires extra effort
- Makes it more durable for much less technical employees to attain
2. HTML inline embedding (Base64 encoding)
HTML inline embedding is rather more easy, principally since you don’t need to fully roll your emails and dig round in Multipurpose Web Mail Extensions or MIME to make use of it.
Embedding a picture in an electronic mail first requires that you’ve a model of the mentioned picture as a Base64 encoded string. As soon as your encode your picture, leap into your template, or no matter HTML you ship out, and embed it utilizing a typical HTML picture tag:
<img alt="My Picture" src="knowledge:picture/jpeg;base64,/9j/4S/+RXhpZgAATU0AKgAAAAgACAESAAMAENkDZ5u8/61a+X...extra encoding" />
You then’re accomplished. Ship away.
Execs of HTML inline embedding pictures
- Is less complicated to attain
- Is far quicker to do
- Requires much less deep dive into MIME and utility code
Cons of HTML inline embedding pictures
- Can actually improve the dimensions of emails, particularly in case you use multiple picture
- Is more than likely blocked by default in lots of webmail providers
- Is blocked fully in Outlook
3. Linked pictures
As you may see from the above instance, in case you attempt to use plenty of Base64 encoded pictures in your electronic mail, the precise measurement of the e-mail despatched will improve considerably, slowing down sending. Your various to that is to hyperlink out to your pictures and cargo them from an exterior server.
There’s nothing tremendous technical to attain right here. It’s simply linking to a picture in HTML. Nevertheless, you must think about the next if taking this method—how many individuals will obtain this electronic mail, and the place are they on the earth?
For those who ship to 100 individuals over the course of per week, then you definately don’t want to contemplate this a lot—you possibly can host your pictures within the public folder of your Dropbox account if you need, and it might be greater than enough.
Nevertheless, if 200,000 individuals will get your electronic mail over the course of someday, then it might be sensible to have your picture saved on a Content material Supply Community corresponding to Amazon’s CloudFront.
Observe these easy steps to make use of linked pictures in your emails:
- Add pictures to a listing in your server or into any cloud storage public folder
- Cut back the picture measurement in order that it doesn’t require further bandwidth
- Hyperlink to the pictures in your HTML electronic mail with the complete URL path
- Make sure the picture is publicly accessible
Execs of linked pictures
- Retains electronic mail weight gentle
- Requires little or no additional effort
- Permits for modifications to pictures after sending
Cons of linked pictures
- Suffers the identical blocking issues as Base64 encoding on most providers
- Requires obtain from exterior servers
Take a look at your emails earlier than sending
No matter which picture embedding technique you select, you’ll wish to take a look at your emails earlier than you ship. With our built-in Electronic mail Testing, you may see how your advertising and marketing emails look throughout purchasers, browsers, and units—together with iOS, Android, Gmail, Outlook, and extra.
Testing your emails beforehand will let you realize if a picture fails to render on an essential browser or in a well-liked inbox. In case your SendGrid stats present that the majority of your recipients use Gmail, then you definately’ll wish to take a look at your emails to ensure your pictures render correctly in that inbox.
Does your picture render accurately? Congratulations! If it doesn’t, then it’s time to begin the troubleshooting. A easy resolution could also be to experiment with one other picture embedding technique. Change up your technique, ship one other take a look at electronic mail, and see if that mounted the issue.
Even when your pictures do render, it’s essential to design emails with the idea that the pictures will not load. No matter your recipient’s browser, machine, or inbox, they could have adjusted their private settings to mechanically block pictures. Thus, you’ll want to ensure your emails look nice (not damaged) when the picture you deliberate for doesn’t seem.
Additionally, embody ALT textual content to make your emails extra accessible to your visually impaired subscribers. Plus, if the picture fails to load, your nonvisually impaired subscribers will know the context across the picture that didn’t load.
Preserve your deliverability
Enjoying round with pictures can have adversarial results in your deliverability. Right here are some things you’ll need to bear in mind as you add pictures to your emails.
Don’t add attachments
Regardless if it’s a PDF, flyer, or cute cat GIF, don’t add attachments to your emails. Inbox suppliers will often flag emails with attachments as spam, even when the content material of your electronic mail is legit. For those who’d like to incorporate any of those picture components, both add them by way of the three strategies we talked about above or hyperlink out to them with an efficient name to motion.
Embody extra than simply a picture
With a picture, you may have full management over all of the design components and may actually create a one-of-a-kind inbox expertise. Nevertheless, having your electronic mail solely encompass a picture (with no textual content) may cause your electronic mail to be flagged as spam.
Don’t add too many pictures
Add selection to your electronic mail. Embody pictures (sparingly) with textual content blocks and headers all through. Nevertheless, be conscious that too many pictures might be a adverse issue to your deliverability.
You probably have extra questions on electronic mail deliverability, obtain our latest Electronic mail Deliverability Information. It’s chock-full of all the most recent ideas, tips, and recommendation to ensure your emails get delivered the place meant.
What’s the easiest way to embed pictures in electronic mail?
It’s fairly bleak, isn’t it? Sadly, unified help for any of those strategies isn’t going to occur, so it’s essential to take into consideration what you ship and to whom. On prime of that, it’s essential to take into consideration the place recipients will learn it.
You should utilize the analytics knowledge out of your SendGrid account to construct up an image of who reads what and the place they learn it. As soon as you realize that, you possibly can programmatically select the very best template and embedding technique for them.
Total, it’s greatest to maintain imagery gentle in transactional emails and get to the essential stuff rapidly, which implies principally you’ll need a emblem or two in there. The remainder you may obtain utilizing inline CSS.
One of the simplest ways to determine what is going to fit your wants is to take a look at emails from larger-scale firms, corresponding to Amazon, Pinterest, Spotify, or Twitter. View the code, have a look at their electronic mail headers, and uncover what works for them, then apply it to your emails and take a look at, take a look at, take a look at.*
*Useful trace: Don’t use iOS Mail for testing. It’s very form to pictures and hundreds just about every thing. Take a look at with Gmail and Outlook in case you can.
Greatest practices for embedding pictures in emails
With regards to embedding pictures in emails, there are a number of greatest practices you must think about to make sure optimum compatibility and deliverability throughout totally different electronic mail purchasers and units.
Listed below are some pointers:
- Use the right picture format: Follow extensively supported picture codecs like JPEG, PNG, or GIF. Keep away from utilizing unusual or proprietary codecs that will not render accurately in all electronic mail purchasers.
- Optimize picture file measurement: Giant picture recordsdata can improve electronic mail load occasions and will get blocked by sure electronic mail purchasers. Compress your pictures to an acceptable measurement with out compromising an excessive amount of on high quality.
- Contemplate responsive design: Design your emails to be responsive, that means they adapt to totally different display screen sizes and orientations. Be certain that your pictures scale appropriately to suit the display screen with out inflicting distortion or extreme scrolling.
- Use various textual content (alt textual content): At all times embody descriptive alt textual content to your pictures. Alt textual content is displayed when pictures are blocked or can’t be loaded, offering recipients with context and accessibility. It’s additionally useful for people utilizing display screen readers.
- Take a look at throughout a number of electronic mail purchasers: Completely different electronic mail purchasers and units might render pictures otherwise. Take a look at your emails throughout numerous in style purchasers (e.g., Gmail, Outlook, Apple Mail) and units (desktop, cellular, pill) to make sure your pictures show correctly.
- Present a transparent name to motion: In case your electronic mail comprises clickable pictures, guarantee there’s a clear name to motion (CTA) with textual content or a button. Some recipients might not perceive that a picture is clickable, so together with specific directions can enhance engagement.
- Keep away from image-only emails: Relying solely on pictures to your electronic mail content material could be problematic. Some electronic mail purchasers might block pictures by default, leaving recipients with an empty or uninformative electronic mail. At all times embody related textual content alongside your pictures.
Enhance electronic mail engagement by embedding pictures with Twilio SendGrid
Once you run all these exams and take a look at these totally different strategies, keep in mind why you’re attempting to embed emails within the first place. Is it to enhance your model consistency? Perhaps it’s to enhance electronic mail engagement? Or is it to maintain up together with your rivals?
With Twilio SendGrid, we may help you monitor your sending analytics and examine and distinction your outcomes. For those who attempt sending image-rich emails for a few weeks however discover your engagement dipping, it may not be definitely worth the slight bump in your model consistency.
Your viewers varies as extensively because the totally different electronic mail purchasers, browsers, and units—be sure to incorporate their desires and wishes in your design choices, too.
Prepared to begin sending higher emails? Join a free Twilio SendGrid account immediately (no bank card required) and make the most of our first-class editor, which helps you to construct emails with the next:
- Design Editor: Drag and drop device
- Code Editor: Develop emails from scratch
- Hybrid Editor: Use code and drag and drop