Search code examples
phpemailemail-client

Dynamic email template to different email clients - PHP


I have been searching for answer for a while but i could not find one direct answer.

I am working on a news letter module for a web application built in PHP. Application sends large amounts of emails to users. I need a way to send different email templates based on device/client user uses to read the email. especially mobile clients.

At least I want to distinguish desktop and mobile versions. Is there a way for this.


Solution

  • In a word no. HTML emails are handled by the email provider itself. Gmail (for example) as a provider will show content to the end user regardless of the device you are using.

    That said if you design your template well enough to be considered "responsive" you can spoof your idea by having automagically shrinking tables.

    Also no email provider allows javascript in templates for security reasons and very few allow full CSS rules and only support basic CSS 2.