Reputation: 811
I'd like to see if there's a way to customize an HTML e-mail based on the user's e-mail client.
I'm wondering if there might be a reliable way to do this with something sort of like a user-agent that would indicate that it's being viewed in Gmail, Outlook, etc. Then if there's a simple way to show and hide a few IDs that would contain client specific things sort of like a media query. I don't see any support for a user-agent media query so that seems like a stretch.
I know modern clients don't tend to support Javascript so that complicates things. TBH, I'd be really surprised if any of this can be done in the first place but figured its' worth asking.
For context, this message will tell people how to edit to their e-mail signature, which is different in each client. I'd rather have one dynamic set of instructions instead of including instructions for every client.
Upvotes: 0
Views: 515
Reputation: 5224
This is sometimes possible, but it changes because it's essentially based on bugs and non-official ways of targetting.
Check https://howtotarget.email/ for the latest ways of targetting different email clients.
For example, Outlook windows:
<!--[if mso | ie]>
<td>ALL OUTLOOK</td>
<![endif]-->
Also this bug works for targetting Yahoo and Gmail IMAP (one version of Gmail):
<!--Yahoo->
<p style="background:red;color:white;font-size:50px;">You are using Yahoo or AOL</p>
<!yahoo-->
Outlook.com (must be placed in a style block in the body, not in the head)
.olm-fragment-custom .your-class-name {
/* Replace this comment with your styles */
}
Upvotes: 1