I watched a few online tutorials and set up inky and premailer to give styling to emails in an organised way, and am very happy with this set up.
premailer gem should automatically generate the text.erb email based on the html.erb email. According to here that should still work when using inky, but when I visit my mailer in the browser and select the 'View as plain-text email' option, I see the regular booking_confirmation.text.erb file with whatever I put in it manually, rather than the booking_confirm.inky file's body.
How can I get premailer to generate the plain text email based on the .inky file?
Notes:
- Useful premailer info: https://makandracards.com/makandra/61772-auto-generating-plain-text-bodies-for-html-e-mails-in-rails-apps
- Tutorial on inky + premailer: https://www.youtube.com/watch?v=lUFgOiYP9yM
After randomly playing about with different extensions and other things, I realised it's simple: premailer/inky will only generate the plain text equivalent of the HTML file if a file of that name with extension
.text.erbdoesn't already exist.In other words, to get a auto generated version of
booking_confirmation.inky, you simply need to deletebooking_confirmation.text.erb, then it will auto generate.