Wednesday, February 13, 2019

Changing the first line preview in email clients

In many email clients it will now show you the first line of the email body before you open it. If you are a developer creating this email sometimes it shows things like a url of a header image instead of something more useful. The good news is you can trick the email clients into displaying whatever you want. Just make sure the first thing in your body tag (can be after the style tag, etc) is the following:

<!-- HIDDEN PREHEADER TEXT -->
<div style="display: none; mso-hide: all; width: 0px; height: 0px; max-width: 0px; max-height: 0px; font-size: 0px; line-height: 0px;">
    Whatever you want to see in the preview here
</div>

No comments: