Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: premailer support #24

Closed
jcdarwin opened this issue Oct 8, 2018 · 5 comments
Closed

Feature request: premailer support #24

jcdarwin opened this issue Oct 8, 2018 · 5 comments

Comments

@jcdarwin
Copy link

jcdarwin commented Oct 8, 2018

The Campaign plugin is great, but we're running into an issue whereby the client wants to create content in rich text (i.e. Redactor) fields on the Campaign.

Given that we need to use inline styles to get a good support of HTML emails across different email clients, is there any way we can use a premailer library (e.g. https://github.com/crossjoin/PreMailer) to process a stylesheet into inline styles before the email is sent out?

This may mean providing a means whereby we can use some form of plugin with Sendouts and test emails.

@putyourlightson
Copy link
Collaborator

I'm using Redactor fields with the Campaign plugin without any issues. Provided your email template is set up correctly with inline styles, they should also apply to any markup that Redactor outputs. Have you run into any problems with this? I'm open to adding support for premailer would would like to understand what the issue is first so I can address it for you and others too.

@jcdarwin
Copy link
Author

jcdarwin commented Oct 8, 2018

The boilerplate of my email template is all setup with inline styles and works fine -- the problem is that I've got a body field that is a rich text (i.e. redactor) field into which the client can type any combination of HTML (as allowed by redactor).

I then output this in the template at the appropriate point using {{ unescape(campaign.body) | raw }} -- however of course I get HTML but no inline styles.

The main problem here is that the <p> tags get rendered using a serif font, but these should be rendered using a particular font-family -- with premailer I'd be able to do <p style="font-family: Calibri, Candara, Segoe, 'Segoe UI', Optima, Arial, sans-serif;>.

I might be missing something here, but I can't find another way (other than using inline styles on the <p> tags) of controlling the font-family.

@phoob
Copy link
Contributor

phoob commented Oct 8, 2018 via email

@jcdarwin
Copy link
Author

jcdarwin commented Oct 8, 2018

@phoob Thanks for the link! Yep, I've switched to an embedded stylesheet, and it seems to work -- will do some testing across other email clients over the next day or so, but if the email client support for embedded stylesheets is good enough that we can forego inline styles, that'd be fantastic (and there's then no need for premailer)

@putyourlightson
Copy link
Collaborator

Yep I've heard great things about https://mjml.io/. Let us know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants