Read Time: 28 min

How to Create an “Add to Calendar” Link for Your Emails

Categories

In-person or virtual events revolve around getting to know other people and learning from one another. Because email is such a personal channel, it’s the ideal medium to build excitement for events and send those all important event reminders.

Why You Should Use Calendar Links in Email Campaigns

To ensure that guests actually show up, include an “Add to Calendar” link in your event emails. With that, subscribers can add your events to their own calendars, helping them avoid calendar conflicts and allowing them to set up their own reminders. And maximizing the chance of them attending your event.

Traditionally, this is done with an ICS file—also known as iCalendar. This is a common calendar format that typically uses the .ics file extension and is widely accepted by most calendars. Not to be confused with Apple’s iCal, which shares a similar name, although iCalendar files do work there as well. For clarity, we’ll refer to this as an ICS or calendar file throughout this blog post.

Some calendars can also add events from web links—what we’ll refer to as calendar links. Taking the extra time to dynamically show the “Add to Calendar” link that matches each subscriber’s specific email client can make it easier and faster for your subscribers to add your event to their calendar.

We’ll walk you through which calendars you should care about, creating the actual calendar files and links, and coding these files and links into your event email for the best subscriber experience.

 

Table of Contents

 

Step 1: Choose which calendars to target

There are countless different calendar applications available: ones available by default through your computer or mobile phone’s operating system, as part of your webmail, or another calendar application you’ve downloaded. It’s virtually impossible to support all the calendar applications out there.

To help you understand which calendar tools to focus on, take a look at your Email Analytics data.

Pie chart showing email client data.
Example of email client data from Litmus Email Analytics.

All calendars are capable of using an ICS file to add new events to it. But it requires people to first download the ICS file and then upload it to their calendar.

However, in Gmail, Office 365, and Outlook.com, you can also add events using a link that automatically includes your event details. This leads to a better subscriber experience, since it takes just one click for your subscribers to add your event to their calendar.

Here’s a handy chart that quickly summarizes which calendar accepts which “Add to Calendar” method to help prepare you for the next step.

“Add to Calendar” Method by Calendar

Calendar

ICS Calendar File

Calendar Link

Google Calendar

Outlook.com

AOL

Yahoo

Office 365

Outlook (desktop)

Apple Calendar

 

Friendly reminder: while it’s easier for you to only create an ICS calendar file because it’s accepted by most email clients, it’s not easier for your subscribers.

Personalizing the calendar link for each email client increases the chance that your subscribers will actually add your event to their calendar (and attend and convert!) since it’s just one click away. Making someone add an ICS file to their calendar requires more steps, and you might lose some folks along the way.

Depending on which email clients your subscribers use to read emails, you may choose to create an ICS calendar file, calendar link, or both.

How to create ICS calendar files

Because ICS files power the links for many calendar applications, this is always a great fallback to have.

To get started, we recommend this iCalendar Event Maker tool to generate the files. It allows you to add any information your subscribers may need to know about the event such as location, description, and a URL. You can even get more specific with your event, having it repeat or adding notifications for your guests.

Once your audience adds your file to their calendar, they have the details that make it clear what the event is for. And it acts as a reminder as to why the event is in their calendar.

To create “Add to Calendar” links for webmail calendars, we suggest Amit Agarwal’s Calendar Links tool. It will generate the entire URL you’ll need to include in your email.

There is a downside to this tool: you can’t create recurring events or include a notification like you can with ICS files. You can add these details to the calendar URLs, but you’d have to create them in each calendar, which you may not have access to.

This is why it’s good practice to create an ICS calendar file in addition to calendar links.

Litmus logo

Never send a broken email again

Prevent email errors—like broken “Add to Calendar” links—with automated QA testing. Send on-brand, error-free emails with confidence (and protect your brand reputation).

Start your free trial →

 

Before we get to the really fun part (coding!), you need to decide how you’re going to present your “Add to Calendar” link.

Decide how to display your “Add to Calendar” button

As we mentioned earlier, traditionally, there are multiple “Add to Calendar” links along with the ICS file button. When using dynamic buttons as your Add to Calendar buttons, you have two different options:

  • Show one: You can target each subscriber’s email client and dynamically display the specific link that matches their email client.
  • Show all: You can use a hybrid model where the main call-to-action (CTA) button is personalized for each subscriber’s email client, and you still provide the alternative calendar links.

If you can personalize the “Add to Calendar” link for every subscriber, you might wonder why you’d want to consider showing the other calendar links at all.

Showing just one link doesn’t take into account people like, well, me. I’d often use my work email to sign up for emails so I could see what they looked like in Outlook. But I’d want to add the event to my personal Gmail calendar. This can be a point of friction for people if only one calendar link is provided.

The second option of showing multiple calendar links is a great way to solve this problem.

Add to Calendar email example
Example of a personalized button with calendar links

It’s a little more complicated than just hiding and showing CTA buttons based on email client preference, but it provides the best user experience in my opinion, as you meet the subscriber in their inbox, but still accommodate for any workflow they may have.

So, now for the fun part: coding the ICS file button as the default. Start with this because it works everywhere no matter which email client, app, or device your subscribers read from.

First, get the ICS file you created in step 2 using the iCalendar Event Maker tool. Then, upload it to your company’s servers, content management system (CMS), or email provider’s media library.

Now it’s button building time. There are lots of different ways to build a button; you can check out our Ultimate Guide to Bulletproof Buttons for a few of them. These days, we’re a fan of Mark Robbins’ accessible button, so here’s an example of that you can use:

<a target="_blank" rel="noopener" target="_blank" href="https://campaigns.litmus.com/_email/test/newnewyork.ics" class="cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:30pt"> </i><![endif]--><span style="mso-text-raise:15pt;">Add to your Calendar</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%"> </i><![endif]--></a>

Then, create the URLs for the other email client’s calendar links you plan on using and put them under the button you just created:

<p style="font-family: Helvetica, Arial, sans-serif; color: #fdfdfd; font-size: 18px; line-height: 24px; margin: 20px 0 0 0;">
<a target="_blank" rel="noopener" target="_blank" href="https://outlook.office.com/calendar/0/deeplink/compose?body=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&enddt=2022-01-12T20%3A00%3A00%2B00%3A00&location=New%20Earth&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-01-12T18%3A00%3A00%2B00%3A00&subject=Welcome%20to%20the%20Motorway" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Outlook.com</a> | <a target="_blank" rel="noopener" target="_blank" href="https://outlook.office.com/calendar/0/deeplink/compose?body=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&enddt=2022-01-12T20%3A00%3A00%2B00%3A00&location=New%20Earth&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-01-12T18%3A00%3A00%2B00%3A00&subject=Welcome%20to%20the%20Motorway" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Office 365</a> | <a target="_blank" rel="noopener" target="_blank" href="https://calendar.google.com/calendar/render?action=TEMPLATE&dates=20220112T180000Z%2F20220112T200000Z&details=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&location=New%20Earth&text=Welcome%20to%20the%20Motorway" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Google</a> | <a target="_blank" rel="noopener" target="_blank" href="https://calendar.aol.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" target="_blank" style="color: #fdfdfd; text-decoration: underline;">AOL</a> | <a  target="_blank" rel="noopener" target="_blank" href="https://calendar.yahoo.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Yahoo</a></span></p>

At this point, you could stop. This code provides the button and additional links for the best subscriber experience. However, if you want to provide a more personalized experience by creating a dynamic button that works in the email client your subscribers are opening your email in—read on!

For each email client that you want to target, you’ll have to create a new version of the button. And then show and hide the buttons and the links under the button with email client specific CSS.

Pro tip: put each targeting CSS in its own style block as adding them to the main style block has been known to mess with the targeting.

So which email clients can you target?

  • Gmail
  • Office 365
  • Outlook.com
  • Yahoo/AOL

You can also target the desktop client for Outlook, but since that would use the default button anyway, you don’t need to target it for once. (Wahoo!)

Before we can get to the nitty gritty of how to target each email client, we need to create the different versions of the buttons. Since we don’t want these buttons to show up on Outlook desktop clients, we’ll wrap them all in a conditional statement. Then we’ll copy the button from above once for each email client we want to target and update the links. Which leads us to something like this:

<!--[if (gte mso 9)|(IE)]><!-->
<a target="_blank" rel="noopener" target="_blank" href="https://calendar.google.com/calendar/render?action=TEMPLATE&dates=20220112T180000Z%2F20220112T200000Z&details=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&location=New%20Earth&text=Welcome%20to%20the%20Motorway" class="cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your Google Calendar</span></a>
                                  
<a target="_blank" rel="noopener" target="_blank" href="https://outlook.office.com/calendar/0/deeplink/compose?body=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&enddt=2022-01-12T20%3A00%3A00%2B00%3A00&location=New%20Earth&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-01-12T18%3A00%3A00%2B00%3A00&subject=Welcome%20to%20the%20Motorway" class="cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your Outlook Calendar</span></a>
                                  
<a target="_blank" rel="noopener" target="_blank" href="https://calendar.aol.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" class="cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your AOL Calendar</span></a>&nbsp;&nbsp;
                                  
<a target="_blank" rel="noopener" target="_blank" href="https://calendar.yahoo.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" class="cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your Yahoo Calendar</span></a>
<!--<![endif]-->

<a target="_blank" rel="noopener" target="_blank" href="https://campaigns.litmus.com/_email/test/newnewyork.ics" target="_blank" style="color: #fdfdfd; text-decoration: underline;">iCal file</a>

That’s wonderful, but now you’ve got a bunch of buttons showing up and links showing up. Let’s clean all that up by adding some targeting classes.

Start with the Default

We’ll add default classes on the ICS file button so we can hide/show it:

<a target="_blank" rel="noopener" target="_blank" href="https://campaigns.litmus.com/_email/test/newnewyork.ics" class="default cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:30pt">&nbsp;</i><![endif]--><span style="mso-text-raise:15pt;">Add to your Calendar</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%">&nbsp;</i><![endif]--></a>

Then we add a <span> around the link for the ICS file and add a class so we can hide it when the default button is showing:

<span class=”default-hide”><a target="_blank" rel="noopener" target="_blank" href="https://campaigns.litmus.com/_email/test/newnewyork.ics" target="_blank" style="color: #fdfdfd; text-decoration: underline;">iCal file</a></span>

Now that we’ve got the classes we’ll create the style block to do the hiding and showing:

<!--default styles-->
<style>
        .default-hide { display: none !important; mso-hide: all; }
</style>

As we add the classes to the rest of the buttons, we’ll come back to this style block and hide them as the default.

Gmail

Moving on to the Google button, we add a class to the button so we can show it:

<a target="_blank" rel="noopener" target="_blank" href="https://calendar.google.com/calendar/render?action=TEMPLATE&dates=20220112T180000Z%2F20220112T200000Z&details=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&location=New%20Earth&text=Welcome%20to%20the%20Motorway" class="gmail-show cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your Google Calendar</span></a>

And then we add a class on a span and wrap it around the Google link to hide it:

<span class="gmail-hide"><a  target="_blank" rel="noopener" target="_blank" href="https://calendar.google.com/calendar/render?action=TEMPLATE&dates=20220112T180000Z%2F20220112T200000Z&details=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&location=New%20Earth&text=Welcome%20to%20the%20Motorway" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Google</a></span>

For the style block for Gmail we’ll take advantage of the fact that Gmail automatically changes the doctype to <u></u>. This is placed adjacent to a <div> element that inherits class and ID from the <body> tag. So use the following to target content in Gmail:

u + .body .foo {} 

The style block to hide the default and show the Gmail button looks like so:

<!--gmail styles-->
<style>
        u + .body .gmail-show { display: inline-block !important; }
        u + .body .gmail-hide { display: none !important; }
        u + .body .default { display: none !important; }
        u + .body .default-hide { display: inline-block !important; }
</style>

And the default style block gets updated as well:

<!--default styles-->
<style>
        .gmail-show { display: none !important; }
        .default-hide { display: none !important; mso-hide: all; }
</style>

Outlook.com and Office 365

The button for the Outlook web apps has one button that works for both of them. So the button ends up like this:

<a target="_blank" rel="noopener" target="_blank" href="https://outlook.office.com/calendar/0/deeplink/compose?body=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&enddt=2022-01-12T20%3A00%3A00%2B00%3A00&location=New%20Earth&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-01-12T18%3A00%3A00%2B00%3A00&subject=Welcome%20to%20the%20Motorway" class="cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your Outlook Calendar</span></a>

For adding the calendar links, we’ve included copy for both Outlook.com and Office 365 to remove any confusion for our subscribers, but since they’re both the same link, we can wrap the span around both of them:

<span class="outlook-hide"><a  target="_blank" rel="noopener" target="_blank" href="https://outlook.office.com/calendar/0/deeplink/compose?body=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&enddt=2022-01-12T20%3A00%3A00%2B00%3A00&location=New%20Earth&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-01-12T18%3A00%3A00%2B00%3A00&subject=Welcome%20to%20the%20Motorway" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Outlook.com</a>
<a  target="_blank" rel="noopener" target="_blank" href="https://outlook.office.com/calendar/0/deeplink/compose?body=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&enddt=2022-01-12T20%3A00%3A00%2B00%3A00&location=New%20Earth&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-01-12T18%3A00%3A00%2B00%3A00&subject=Welcome%20to%20the%20Motorway" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Office 365</a></span>

There may be some confusion as Office 365 has both a desktop and a webmail client. However, the targeting only applies to the Outlook webmail client which ensures the main button for the desktop client links to the ICS file while in the webmail client, it’s the URL to the calendar link.

Both Outlook.com and Office 365 webmail prefixes class names with x_ but doesn’t do this on attribute selector. So your styles block can be targeted with:

[class="x_foo"] {} 

…and it’ll only apply to the Outlook webmail client. Therefore, the style block for the Outlook webmail client looks like this:

<!--owa styles-->
    <style>
    [class~="x_outlook-show"] { display: inline-block !important; }
    [class~="x_outlook-hide"] { display: none !important; }
    [class~="x_default"] { display: none !important; }
    [class~="x_default-hide"] { display: inline-block !important; }
    </style>

And the default block needs to be updated as well:

<!--default styles-->
    <style>
        .gmail-show { display: none !important; }
        .outlook-show { display: none !important; }
        .default-hide { display: none !important; mso-hide: all; }
    </style>

Yahoo and AOL

Yahoo and AOL are targetable with the same code. Both support calendar links these days. You can create the add to calendar link for Yahoo using the above tool. Then to make the AOL link, you’ll replace “yahoo” in the URL with “aol” and voila AOL calendar link.

Since there isn’t a way to target AOL or Yahoo separately, you’ll need to include both versions of the buttons for those email clients, so they both get the same class:

<a target="_blank" rel="noopener" target="_blank" href="https://calendar.aol.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" class="yahoo-show cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your AOL Calendar</span></a>&nbsp;&nbsp;
                                  
<a target="_blank" rel="noopener" target="_blank" href="https://calendar.yahoo.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" class="yahoo-show cta btn-yellow" style="background-color: #F4D66C; font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight:bold; text-decoration: none; padding: 14px 20px; color: #1D2025; border-radius: 5px; display:inline-block; mso-padding-alt:0; box-shadow:0 3px 6px rgba(0,0,0,.2);"><span style="mso-text-raise:15pt;">Add to your Yahoo Calendar</span></a>

And the both the AOL and the Yahoo links will be added in one span, much like the two Outlook links:

<span class="yahoo-hide">&nbsp;|&nbsp;<a target="_blank" rel="noopener" target="_blank" href="https://calendar.aol.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" target="_blank" style="color: #fdfdfd; text-decoration: underline;">AOL</a> | <a target="_blank" rel="noopener" target="_blank" href="https://calendar.yahoo.com/?desc=Learn%20all%20about%20the%20rules%20of%20the%20Motorway%20and%20how%20to%20access%20the%20fast%20lane.%0A%0Ahttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGridlock_%28Doctor_Who%29&dur=&et=20220112T190000Z&in_loc=New%20Earth&st=20220112T170000Z&title=Welcome%20to%20the%20Motorway&v=60" target="_blank" style="color: #fdfdfd; text-decoration: underline;">Yahoo</a></span>

To target Yahoo and AOL we take advantage of the fact that Yahoo and AOL will replace .& with their wrapping id. So your Yahoo and AOL styles can be targeted with:

.& .fubar { } 

This makes the AOL/Yahoo style block look like this:

<!--yahoo styles-->
<style>
.& .yahoo-show { display: inline-block !important }
.& .yahoo-hide { display: none !important }
.& .default { display: none !important }
.& .default-hide { display: inline-block !important }
</style>

And then the default style block needs to be updated one last time…

<!--default styles-->
<style>
    .gmail-show { display: none !important; }
    .outlook-show { display: none !important; }
    .yahoo-show { display: none !important; }
    .default-hide { display: none !important; mso-hide: all; }
    .default-line { display: none !important; mso-hide: all; }
</style>

So while the above code is beautiful, you’re probably wondering what it looks like when implemented in an actual email. Lucky for you, we coded it up in Litmus Builder so you can see what the “Add to Calendar” button and links look like live and how they render across different email clients and devices.

Keep in mind we used different copy for the different buttons to make sure the correct buttons are showing up in the correct email clients. You could very easily have all the buttons say “Add to Calendar”. If you do that, make sure the correct buttons are showing in the right email client by carefully QA’ing your email in each email client.

Now go give your event guests this special email treatment!

Originally published on May 8, 2019, by Jaina Mistry. It has been updated on September 20, 2023, for clarity and with new information.

Litmus Email Guardian icon

Email Guardian is there when you can’t be

Broken emails mean less conversions—like fewer people adding your event to their calendar. Yikes. Prevent email errors and protect your brand reputation with Litmus Email Guardian.

Carin Slater

Carin Slater

Carin Slater is the Email and Content Growth Marketing Manager at Litmus