Search code examples
phpcssemailswiftmailerzurb-ink

Mails send with SwiftMailer not using style blocks


I'm trying to send HTML formatted emails using Zurb Ink template and SwiftMailer. But when I recieve the mail in my inbox all the formatting that was defined in a <style></style> block is removed. I have added to the text/html content-type like so: $message->setBody("HTML HERE", 'text/html'); When I recieve the email all the formatting is removed.

Is this an issue with SwiftMailer or am I missing a configuration value?


Solution

  • Some mail clients will hide styled emails unless you choose to view it as HTML. And certain web mail clients and mail providers will ignore internal stylesheets. You can however use inline style. Example:

    <font color="red">This is red</font>
    

    or

    <a style="color: #333333;">link</a>