The Pain of Multimedia in HTML Emails
Tags: html, emails, multimedia
Published: 2020-05-06 07:47:18

#### I gave a talk at Frontstack this year and it was an amazing experience. I'm sharing the essence of my talk here ICYMI and also because I write better than I speak sometimes, so you might enjoy this more.

I'll start off with a quick introduction. [I'm Etin Obaseki](https://etin.space), Software Engineer whose current life motto is [Life, Learn, Loop.](https://notes.etin.space/posts/who-is-etinosa-obaseki)

<p>Multimedia across the web has come in leaps and bounds. We can now easily use various forms of media all across the web almost ubiquitously. Videos, audio, animation. All sorts of wonderful things.</p>

<p>What about emails? Emails are notoriously hard to make look good for a number of reasons. Multimedia is a definite no.&nbsp;<em>Or is it?</em></p>

<p>What can we do right now? What will the email of the future look like? Let’s find out.</p>
<!-- /wp:paragraph -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>The Introduction</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We've all sent emails. Whether it's to let friends and family know how you're doing or to express your 'slight confusion' to a colleague at work or to rail at the customer service unit of your bank for yet another unexplained debit.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The emails we'll be discussing today though are more the kind sent out by brands to their audience. Whether it's a newsletter or a service notification, we'll be discussing if and how we can spruce up that email with multimedia.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you've ever designed and sent out HTML emails, you'll know just how terrible they can be to write and test.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Thankfully, there are more and more tools that make this process a breeze and I share some of my favourite here.</p>
<!-- /wp:paragraph -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>My First Foray into Emails</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>At my first job, I had to build and send our newsletter. My boss had a couple of requirements for the newsletter including:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>A two column layout</li><li>News articles and featured images on each column</li><li>Videos from YouTube</li><li>A Twitter Feed</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>I wrote an entire article on the lesson in humility that this was.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>But, in summary, my first few attempts turned out poorly.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I had not written a HTML email before that, but I figured it would be easy because I had built one or two websites.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>It wasn't and I learnt the first two lessons of my career:</p>

<!-- wp:list {"ordered":true} -->
<ol><li>Don't overestimate yourself (although, sadly, it hasn't stuck as much as I would have liked.) and </li><li>Email != Web</li></ol>
<!-- /wp:list -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>Email != Web</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Although, nowadays, we get our emails over the web, they are different platforms. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Email clients and web browsers evolved very different and as such there are wide variations on the things they can do and how they go about doing those things.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>What can’t we do with Emails?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>I've outlined some of the most jarring not-haves I have encountered while building emails.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>No JavaScript</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Most email clients will, for security reasons, not run any JavaScript at all in your email. So you absolutely cannot rely on any JS tricks for anything in your email.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Embed iFrames</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>One of the requirements for my first email was embedding a “featured video” from our YouTube channel within the email.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>iFrames will be blocked by most email clients as they'll usually contain scripts and could pose a security flaw.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Use HTML5 tags/features</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Because most email clients haven't kept up with the times HTML 5 tags and features will not work here.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Use flexbox, CSS grid or even floats for layout</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Emails use tables for their layouts. No flexbox, no grid. Not even those clever hacks with floats and clearfixes. If you want layouts use tables.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Embed audio or video content</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>No MULTIMEDIA support!!! </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Although multimedia support is non-existent on email, it does support most picture formats quite well and it is one of these that will end up saving everything. The GIF.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>GIF Things Up!</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>GIFs are a great way to add interactivity to our emails.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Similar to the ways we use them on social media, we can add a lot of meaning and context to our emails by creatively applying GIFs.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>It is important to note that images may not always load on an email and so we must design conscious of this point of failure and degrade gracefully in instances where images are not available.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here are a few clever GIF uses in emails I've seen or thought up.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>A Countdown Timer</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>I first saw this done on a marketing email encouraging me to buy at a discounted price before the deadline. And there was a countdown timer right in the email.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":232,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://services.etin.space/notes/wp-content/uploads/2020/04/KpOtd.gif" alt="" class="wp-image-232"/><figcaption>A countdown timer GIF</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>The trick is to have a GIF that counts down for long enough for your users to read your email, say 60 seconds and then update that GIF each time.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a rel="noreferrer noopener" aria-label="This StackOverflow answer (opens in a new tab)" href="https://stackoverflow.com/a/13597274/5381731" target="_blank">This StackOverflow answer</a>, also the source of the GIF above, does a great job of explaining the implementation. Alternatively, you could use a service like <a href="https://cloudinary.com" target="_blank" rel="noreferrer noopener" aria-label="Cloudinary (opens in a new tab)">Cloudinary</a> to create a GIF that continuously updates its countdown time.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Signature/Text Animation</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>What better way to close off your email than with a personal touch?</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A GIF of you signing your name would be very cool (I, at least, would find it very much so).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You could also use it to call attention to your headings.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":236,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://services.etin.space/notes/wp-content/uploads/2020/04/Vanilla-0.5s-251px.gif" alt="" class="wp-image-236"/><figcaption>Yes. This text shaking in different colors is pretty cool. Made with <a href="https://loading.io" target="_blank" rel="noreferrer noopener" aria-label="Loading.io (opens in a new tab)">Loading.io</a></figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3>Animated/Specially Shaped Buttons</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We can make our call-to-actions more appealing by adding animations to them. CSS animations might not work on your email client though and so once more GIFs come to our rescue.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":240,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://services.etin.space/notes/wp-content/uploads/2020/04/animated-button-image-0328.gif" alt="" class="wp-image-240"/><figcaption>An Enter Button. https://www.animatedimages.org/img-animated-button-image-0328-88732.htm</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>We simply create a GIF that looks like the button we want and wrap the image in an <code>&lt;a&gt;&lt;/a&gt;</code> tag.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Video Previews</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Another potential use case for GIF is to preview videos. We could put a short clip as a GIF and allow people link to the full video by clicking.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":246,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://services.etin.space/notes/wp-content/uploads/2020/04/giphy.gif" alt="" class="wp-image-246"/><figcaption><em>Hakuna Matata</em>. GIF from Disney's The Lion King</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Unfortunately, there's no way to include audio that I know of.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>I hope that this gives you some ideas for your next email. If you come up with something cool, I'd love to see it. <a href="https://twitter.com/obasekietinosa" target="_blank" rel="noreferrer noopener" aria-label="Hit me up on Twitter (opens in a new tab)">Hit me up on Twitter</a> and share!</p>
<!-- /wp:paragraph -->