7 Creative Ways to Enhance Your Email Templates

This information is part of my presentation at Salesforce Connections 2025.

These edits are all done in the default salesforce templates. That code is locked down, so in order to do these edits, you need to make a new template from an existing template. There are plenty to choose from.

Retain Button Font Color in Mobile

If you’ve ever used a Salesforce template, you’ve definitely come into contact with the first issue. Even if you have multiple buttons with different text colors, Salesforce will force them all to have the same text color, white, in mobile. That can cause some major issues. What if one of your buttons is light blue and the text is getting forced to white? Your button becomes illegible in mobile. And with the great majority of opens happening on mobile, that could cost you some ROI. Luckily, this one has a super easy fix.

In your template’s code view, you will find mobile global styles inside the mobile media query. The mobile media query is what allows you to change aspects of the email when it displays on screens smaller than 480px. So, phones, basically.

There’s a warning around these styles saying not to change anything. Completely disregard that. Find the buttonstyles class that determines how your buttons look. The 3rd style is color: #FFFFFF !important. The way to get your text colors back in mobile is to remove that !important. That’s it. Told you it was easy.

Add Custom Web Fonts

What is a web font? There are 2 types of fonts. There’s web-safe fonts, which are the ones that every computer has installed on it by default. We know that these fonts will display exactly as expected on all devices. These are your Arials, Helveticas, Times New Romans, etc. They’re either serif or sans-serif.

Then there are web fonts, which can get all kinds of weird. They can be your normal serif or sans-serif, but they can also be script-like, monospaced (like code), or even fonts that use symbols. These fonts must be hosted on a server or come from a service like Google Fonts. If you decide to host your own font, which is quite common so don’t hesitate to do it, a Woff or Woff2 file type is most widely supported.

But of course, with all things email, not every email client supports web fonts. You can use web fonts in Apple Mail, iOS Mail, Outlook for Mac, Outlook App iOS, and Samsung. Only these 5 of the major email clients will show web fonts. Every other email client will show whatever web safe fallback font you’ve specified.

There is one exception to this. Gmail. Gmail doesn’t support Google Fonts except Roboto and Open Sans. Yes I am serious. No, I am not joking. Google mail really doesn’t support its own fonts.

For demonstration purposes I’m going to be using google fonts. Once you’ve found the font you want to use, you’ll click the “get font” button and then the “get embedded code” button. On the following screen, you can use the controls on the left to specify the styles, weights, and widths that you plan to use in your email. On the right side at the top select <link>. Yes, you can use if you want, but <link> has better support, so that’s what I always choose.

When you click link, you’ll be given a block of 3 links. The first 2 links are specifically for Google Fonts, so you don’t need them if you’re hosting your own font. The link doing the heavy lifting here is the one with the URL and the rel="stylesheet". Once these 3 links are placed in your email head, you’ll be able to call the font files from Google Fonts and display them if the email client you’re using supports web fonts. Copy those 3 links.

Under those links, you’re gonna see some code. The only thing you’re going to use from that is how to format the font name, which is the name of the font surrounded by single quotes. That’s how we’re going to tell our email where to use the Roboto font. It’s important to use whatever name is in the quotes right after font-family because that’s how Google Fonts will know which font we want to use. Roboto is pretty easy, but some of the fonts with longer names will use hyphens, so it is important to always use the exact name between the quotes that Google Fonts gives you.

In the Code View of our template, paste those 3 links right after the last <meta> tag in your email code. Save that and we’re now ready to actually use the font.

Click on the content block that has the text you want to be in Roboto. Click on the HTML Editor tab and the first style you’ll see is font-family, followed by Arial, Helvetica etc. This is where we want Roboto to be used, so before Arial, in the very first space after the colon, put the font name between single quotes. It must be the first font in the list in order to work correctly.

Now people with those 5 email clients will see that text in your brand font! Apple has 50% of the market share, so it’s a pretty good bet that at least some of your subscribers will see it. Think of it as progressive enhancement; a nice bonus for those that can see it.

Make Buttons Full-Width in Mobile

Maggie O’Connor, Design Principles for Mobile Navigation Placement, adkgroup.com/perspectives/mobile-navigation-design-principles/

With the great majority of opens happening on mobile these days, you need to make it as easy as possible for a subscriber to click on your buttons. A lot of times, email designs will have the button aligned to the left, making it difficult for those holding their phone with one hand to stretch their thumb across the screen to tap the button. If it’s annoying for you, think about those people with motor impairments! You can fix this for everybody just by ensuring that your buttons span the entire width of the screen in mobile.

To do this, add a class to the table that surrounds the Salesforce button. Click into the HTML Editor tab so you can see the button code. Make sure you put the class on the table that does not have 100% set as the width. It’s the 2nd table in the code. I made up the class name buttonwidth, but you can use any name that makes sense to you.

Go back to the Code View on the template level and find your mobile styles. These guys should look familiar. Again, we’re going to flippantly disregard this warning and add our new buttonwidth class right after the end of the warning, but before the close bracket and set a style of width: 100% !important. That’s how we’re insisting that the button do something different in mobile view.

The last step is to add to the class buttonstyles that is already part of the Salesforce button and is conveniently located just above where you put your new class! At the bottom, right after padding: 10px; , but before the close bracket, add text-align: center !important so that the text will be in the middle of the button. If you forget to add this, the button will be full-width, but your text will be all the way to right.

After you save all those changes, your button will then span the whole width of the email in mobile, saving everyone’s thumbs. We thank you.

Round Image Corners

You’ve probably noticed that there are not a lot of rounded edges in the default Salesforce templates. Rounded corners are everywhere. I honestly can’t remember the last time I did a non-rounded image in any client work.

Right now, you’re probably relying on your designer to export your images with round corners. I’m going to show you how to do it with code.

First, click into the image content block and go to the HTML editor tab. On the image tag, right after text-align: center;, you’re going to add border-radius: and then the amount of rounding you want on your corners (ex. border-radius: 20px;). You want to do this in pixels. Your brand probably has guidelines that you can use to ensure the right curvature, or you can just keep increasing the number till you are satisfied.

The only downside to this is that this does not work in desktop Outlooks.

Round Button Corners in Outlook

Why aren’t your template buttons rounded in Outlook? The answer to this is simple. Microsoft, in their infinite wisdom, decided that, instead of a normal web rendering, Outlook should use Word, the document editing software, to interpret HTML. As part of this, normal, perfectly harmless, common CSS properties like border-radius, aren’t supported, so we get no rounded corners in Outlook.

I dunno y’all… I don’t make the rules. In fact no body makes the rules! There are no standards in email which is why everything looks so different in every email client!

In order to round button corners in Outlook, we’re going to have to build it using a language that basically only Outlook uses at this point called VML or Vector Markup Language.

This results in 2 buttons. One for Outlook in VML, and then another whole separate button for all the reasonable email clients. That means anytime you change a button link in your code, you have to update it twice, because if you don’t, people who open in Outlook are going to go somewhere other than what you intended.

You also can’t use the normal marketing cloud button content block. We’re gonna have to build this puppy with an HTML content block.

<!--[if !mso]><!-->
<a href="https://www.emailsyall.com" style="background: #229efd; text-decoration: none; padding: 15px 25px; color: #ffffff; 
border-radius: 8px; display:inline-block; text-underline-color:#ffffff;">This is a button</a>
<!--><![endif]-->
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" 
href="https://www.emailsyall.com" style=" height:40px;v-text-anchor:middle; width:300px;" arcsize="10%" strokecolor="#229efd" 
fillcolor="#229efd"> <w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:14px;"> This is a rounded Outlook button</center>
</v:roundrect>
<![endif]-->

This is the code. At the top, you can see the button that everyone except Outlook uses. It is surrounded by what’s called an mso conditional. This one says “if not mso”, meaning “if not Outlook”. That ! means not. This is going to hide it from Outlook.

After we close the if-not-Outlook conditional, we open an if mso tag. There’s no !, so only Outlook will see this code, no one else.

Set the URL of the button on the 2nd line and the height & width of the button on the 3rd line. After that the arcsize determines the border-radius, the strokecolor is the border color, and the fillcolor is the background color.

Lastly, put in the button text and close the mso conditional.

Frankly, I copy and paste this code every time I use a VML button. It is a waste of brain power to code VML by hand. Let’s see what all the completely unnecessary code gets us.

On the left is a normal custom HTML button. It is that 1st chunk of code. On the right is the VML button. The reason it is so long is because we had to set a specific width and height of the VML button. The VML button has the rounded corners because of the arcsize.

So there ya go. That’s a bunch of work for even more extra work in upkeep. Have fun.

Lets move on to something actually useful…

Add Hover Effects

A hover effect is when something changes when the cursor over an element of the email. The cool thing about hover effects is It’s the easiest way to make your email interactive! It works in AOL desktop, Apple Mail, Outlook for Mac, Yahoo! Mail, & desktop Gmail.

You can use hover effects to do a lot of things, but here’s how to modify buttons. To put in hover effects, we use what’s called a pseudo class. That’s denoted by :hover.

Salesforce already provides a class to target all buttons, buttonblock. In the Code View of the template, add the necessary styles to the head, just like we did before. First, add the class buttonblock, followed by <a> because we’re targeting the anchor, or link tag part of the button. That’s where the background color is defined in the button code. Put a colon to denote the pseudo class and lastly hover. Then add your background-color with an !important (ex. .buttonblock a:hover {color: #FFFFFF;}). If you wanted to change the color of the border or the text color, you could add those styles here too.

Remember this targets all the buttons in the email, so anytime a subscriber puts their mouse on top of any button in the email it will trigger the hover. The button will return to the default color when the mouse is moved off the button.

But what if you want different background colors on hover for each button separately? To do that, go into the HTML Editor tab of the button you want to add the hover effect to and find the anchor tag; it starts with <a>. There is already a class of buttonstyles on this a tag, so add a new class next to it. Since there are 3 individual buttons in this email, I’ve used the class name button1. Classes button2 and button3 are put on the other two buttons exactly the same way in the same place. Once your classes are in place, go to the Code View of the template and add the hover styles. Similar to last time, we’ll put our new class followed by a colon and hover. We’re not including the <a> before hover on this one because we put the button1 class on the <a> tag, so there’s no need to specify any further.

After that, add a background color and text color with the normal !importants to override the inline button styles. Do this for all 3 buttons. Once done, the background color of each button changes when we hover over each button individually. This could only be achieved because we put different classes on each button.

Swap Images for Mobile

Why would you want to show one image in desktop and a different one in mobile? There’s a lot more real estate on desktop than on mobile, which is usually the catalyst for a swap. The most common reason I’ve seen for swapping an image in mobile is when the desktop image is scaled down, you have a hard time seeing the main focus of the image. Usually there’s just too much space on the sides of the image so you need to replace it to retain the same impact.

Take a look at the module I coded for one of my clients. As a regular desktop image, it scales in proportion. If that desktop image were used in mobile, it would be much shorter, and the woman would be super small. Cutting off the sides of the desktop image maintains the focus on the woman and the general feel of the email.

To swap in an image, we need to use the mobile media query. It’s the same place with that oh-so-helpful warning we’re completely ignoring.

Step 1, open the HTML editor tab on the image you want to swap, locate the <a> tag, and add a class to it. I’ve used hidem, hide on mobile. Adding this class will allow us to hide the image on mobile.

Next step, while we’re still in the image HTML editor tab, is to add the image you want to show in mobile directly after the desktop image. Obviously, you’ll need to use the url of the mobile-only image, but there are 3 additions to this new image tag that are necessary as well.

First, you must put display: none as a style on the mobile-only image. This will hide the mobile image on desktop. We don’t want both the desktop and mobile images to show at the same time, so that’s why we’ve added the display:none inline on the mobile-only image.

Second, you will need to add a class to the mobile-only image. I’ve used showm for “show on mobile”. This class will be used to show the mobile-only image on mobile, so it is imperative that it be added.

The last step on the mobile-only image code is to surround it with an if not mso conditional. If you do not include this conditional exactly in this format, you will see both the desktop and mobile versions of the image in Outlook.

If you use this technique with a Salesforce image block, the code between the Outlook-only tags will disappear if you go back into the HTML editing pane to make edits, so, try not to re-edit.

We’ve prepared our images, so now it is time to do the swap. As usual, we’re going to go back into the template Code View and add styles underneath the mobile global styles warning.

First, add the class hidem and put a style of display: none !important. Below that, add the class showm with a style of display: block !important. Once you save that, you can go back into your email and see that the desktop image is hidden and the mobile image is visible when the email is viewed on mobile.

Begin Your Journey to Better Emails