foundation / foundation-emails

Quickly create responsive HTML emails that work on any device and client. Even Outlook.
https://get.foundation/emails/docs/
MIT License
7.77k stars 1.09k forks source link

Generate plain text emails #869

Closed lipis closed 4 years ago

lipis commented 6 years ago

It's not uncommon to send the text version among with the HTML version when sending emails.. how about generating the text version when building for production?

Does anyone have to do that as well.. what's your solution to it.. (besides doing it manually)?

rickysullivan commented 6 years ago

I'm looking at using https://github.com/cheeriojs/cheerio and https://github.com/werk85/node-html-to-text to render my plain text versions.

lipis commented 6 years ago

thanks @rickysullivan

jonathanimo commented 6 years ago

@rickysullivan any luck with implementing those packages for generating a plain text email?

rickysullivan commented 6 years ago

@jonathanimo I did. But there's a bit of tidying up to do with my templates. I have a lot of handlebars markup that needs to render in Mandrill.

Basically, I added some classes to my tempalte which I call in the function:

htmlToText.fromString(html, {
...(other opts)
baseElement: ["table.pt-header", "table.pt-body", "table.pt-footer"]
})
DanielRuf commented 4 years ago

Currently this is not a feature that we support. This depends on your implementation and there is often a different content for the plaintext version.

Currently this is out of the scope of Foundation Emails.