What is email source code and why should I care?

No matter how long you’ve been in email marketing, you probably already know that open rates and click-through rates are everything.

From adjusting your copy to writing stellar subject lines, there are many ways you can improve these metrics.

However, in doing so, many marketers fail to take time to understand email source code, leaving this to their email marketing platform or the template they’re using.

But your email source code (the HTML code of your email) has the ability to make or break your email campaign, and we’ll find out why below.

Ringly email source code example
Image Source: Campaign Monitor

What is email source code?

The source code of an email will contain the header information for the email and will often include HTML code to style the rest of the message.

This means that, by viewing the source code of an email, you can see when you received the message, what server sent it, and lots of other information.

Why might this be important to you?

Whether it’s just to get to grips with the technical side of emails or it’s to work out why your emails are being sent to someone’s spam folder, the raw source code of any email can be hugely informative. For example, your online support team will probably find it really helpful if someone is able to look at this source code when they’re troubleshooting content or delivery problems from customers.

To better understand this, you may find it useful to look at an email source code example. We’ve shown you how to do this for several different servers below:

View email source code in apple mail

  1. Go into your Mail on your Mac.

  2. Go to View > Message > Raw Source.

This will open up the source code of the email in a separate window where you can print it or save it. You can also do this by hitting Option-Command-U on your keyboard.

These steps are also very similar for Outlook Mac source code.

View email source code in Outlook

  1. Go to the message you want to inspect.

  2. At the top of the message, click Actions.

  3. From this menu, select View Message Source.

You can also get the HTML code from Outlook emails by right clicking on the message in your inbox (before you open it) and clicking on View Message Source from there.

Interpreting the source code in the header of an email

So what exactly could the email header’s source code tell you about the contents of an email, and why might this be important?

Below, we look at the various components that make up an email header so you can understand what each individual part means and what it can show you about the email. However, it’s important to understand that every line within an email header is forgeable so might not be trustworthy.

The only lines that you can trust are the received lines as these are the ones generated by your computer.

  • Received: As we’ve just mentioned, your computer generates this and it details the journey of the email from its source to its destination (your inbox). It’s several lines long and will show all the touch points your email has had in its journey.

  • Return-path: This may be different from the “from address” and depicts the “reply to” address.

  • Authentication-results: This shows to what degree the sender’s server verifies the credentials of the sender.

  • Date: When the message was originally sent by the sender.

  • From: The email address used to send the message. This often displays the sender’s name, too.

  • Reply-to: If you hit “reply,” this is the email address that the message will go to. Again, this might not be the same address as the one that sent the email.

  • Message-ID: This is the email’s tracking number.

  • Precedence: Servers use this part of the header in different ways, while some may not use it at all. Essentially, it’s a ranking system which indicates the type of message it is. For example, “bulk” suggests that it’s going to a mass number of email addresses.

  • List-unsubscribe: This allows you to unsubscribe from the email using a keyed reference that comes directly from the mail list of the message.

  • X-spam-score: This is a number that’s given by your own email server to stipulate how likely it is that this email is spam. Emails that score below a specific number may head straight for the spam bin.

There’s a vast amount of email headers out there, but these specific data points can tell you a lot about an email and its sender.

What to consider when designing emails

Hopefully, all of the above has given you a glimpse into what email source code entails—but, as you may note, we’ve only touched upon the email header.

When designing the entire email using HTML code, there’s far more that you need to get to grips with. From building out tables to place your content in to ensuring you’ve chosen the right width for mobile users, coding your own emails takes a lot of technical know-how and coding abilities.

Sounds too complicated, right?

Thankfully, even if coding isn’t your “thing,” there are ways that you can craft these beautifully designed HTML emails without blood, sweat, and tears.

Casper HTML designed email

Image Source: Campaign Monitor


You see, a lot of email marketing platforms, like Emma, offer you a drag-and-drop interface that allows you to build an HTML email from the front-end. So you don’t need to understand code in its entirety to get your email right.

Rather, this platform will do all of the hard work for you, while still allowing you to work on your coding if you wish (You can often view the HTML source of the email as you create it).

But are these HTML emails better than plain-text emails?

HTML emails vs. plain-text emails

A lot of emails today, whether you’re building them through an email marketing platform or are using your email provider’s tools, will include HTML. The HTML is what allows you to add colorful displays, engaging images, exciting calls-to-action, and those on-brand fonts.

And these have got to be better than text-only emails, right?

Well, not in every case, no.

Less is sometimes more when it comes to emails, and plain-text versions are far less likely to hit problems due to their simple format. In fact, plain-text emails boast 100% deliverability. And because consistency is a huge priority for customers, this is very important.

Image Source: Really Good Emails

The challenges of coding HTML emails 

HTML emails may look good but they do come with a whole host of potential problems, including:

  • Spam: If your code is sloppy, it can land you straight in the spam folder. For example, the spam filters for email providers will find code that looks like a Word document, and they’ll score your email based on this.

  • Time-consuming: Coding an email can take a lot of time because you need to get your CSS right and also avoid triggering spam filters. Plus, different email clients have different criteria, which means you need to cater to several different standards.

  • End results: Due to this variation in standards, some email providers may strip out bits of your code, ruining the overall look of your email. This is especially the case with Outlook.

  • Blocked images: More often than not, email clients will block images in your email, which, again, ruins the look of them.

Mobile optimization: With so many people reading their emails on the go, HTML emails now need to be designed for mobile viewing, as well as traditional laptops and desk computers. And this presents even more challenges.

The disadvantages of plain-text emails

Despite plain-text emails removing many of the above issues, it doesn’t take a genius to see that plain-text emails are often, well, plain. It’s not hard for them to look boring and this can quickly lead to an unprofessional vibe.

That’s why many email builders allow you to send plain-text versions of more engaging HTML emails, enabling the recipient to choose which they’d rather view. However, when doing this, it’s important to check the text version to ensure it’s properly optimized and renders well.

Alternatively, there are some simplified HTML templates available that take plain-text emails to another level, wrapping them up so they look on-brand but aren’t too cluttered or “salesy.”

Moo HTML sales template
Image Source: Really Good Emails

Plus, when you’re using an email builder like Emma, these help you overcome many of the aforementioned HTML issues. And they’ll give you all the benefits of these HTML emails, including better visual appeal and stunning organized information.

Which emails are best for your company?

This will take some strategic testing to work out. Try different types of emails by doing some A/B testing to see which resonate best with your customers. Then, work on improving these styles to maximize both your open and click-through rates.

Wrap up 

Even if you’re not keen on learning code, understanding the key aspects and why these matter for your business is a good idea.

Being aware of email source code and how this can affect your sender’s reputation, as well as the overall look and feel of the email, will help you continually improve your email campaigns so they skyrocket your business toward success.

To see just how easy it is to create beautifully-designed HTML emails, take a look at our email editor.


About the Author

Emma is an email marketing platform that gives you all the tools you need to send campaigns that really connect with your subscribers. With our

More Content by Emma Email

Want to engage your audience and grow your brand? Try Emma's robust easy-to-use product today.