See Attached Video

I hosted a hardcoded version of the PHP script on my own server for testing. Pay attention to the prices in the video. Notice how it’s the same email.


The Problem

We have customers opening emails hours, even days later than when the email first arrives in their inbox. For that reason we usually don’t include prices since they change so often.

The Solution

Display real time product data at the time a customer opens an email and not when we send them an email. We’ll use product prices in this example.

How Does It Work?

We’re able to do this by leveraging the tag. Instead of linking to an external stylesheet we link to a PHP script that returns CSS. The PHP allows us to hit a rest service to get product data and then format that data into CSS using the “content” property.

Where Does it Work?

This is email after all so it’s not going to work everywhere. The only way this can work is if an email client supports the tag. However, in this example we fallback gracefully by simply not showing the prices.

Email Client Support for Link Tags

The Code

Litmus Previews

Next Steps

Most of the work is done. We would need some sort of a cache so we don’t overload the servers. We do something similar for a countdown script in email. That cache is only 5 minutes if I remember correctly. I would assume we could do something similar here but I would say this is the biggest caveat.

Built With

Share this project: