Pony is a web app for building HTML emails from user-defined templates. It takes care of converting from Markdown and inlining CSS.
We created Pony so that our staff could produce beautifully-designed emails export them to MailChimp without having to touch code. By splitting off the HTML as a header and footer as a reusable template wrapped around a Markdown body, Pony is designed to strike a balance between customization and usability.
MailChimp has written a set of basic guidelines for creating HTML email templates.
We’ve included a sample starter template to get you started.
Creating an email
Create an HTML email template (split as two discrete chunks, a header which might include an opening
<table>tag and a footer which might close the
</table>) and save it in Pony.
Then you can create a new email, select the template you’ve created and paste in the body of the email. Click save, and your live preview will appear. You can then style the email which will adopt the style of any Markdownable elements (such has
<p>) you have declared in the
<style>tag of the template.
Once you’re ready to go, copy the export URL to the appropriate field (Code Your Own Template > Import from URL) inside MailChimp. The export URL is publicly visible (although protected by a random token in the URL) so MailChimp can pull it in.
Deploying to Heroku
Pony relies on magic links to login to its admin interface. When you use the "Deploy to Heroku" button, it will automatically generate a secure token. To find this token, either run
heroku config for the new app, or go to the Heroku admin interface for you app, then "Settings", then click "Reveal Config Vars." Once you have the token, your login URL will look like:
Suggestions for streamlining this process are welcome.
Developing on OS X
Pony is a Ruby on Rails app. Developing on OS X requires Ruby 2.3 (We use
rbenv from homebrew) and Postgres (we use Postgres.app).
Pony is designed to be fairly simple to deploy, so it's opinionated and limited. Its authentication strategy relies on "magic links" – not unlike a password reset link you might be emailed.
To develop locally, you'll have to set at least one of these tokens. In your
.env file (create this if it doesn't exist), add a line that looks like:
cp example.env .env to do the same thing. This will overwrite any other
.env varaiables. The
TOKENS will accept a comma-seperated list of valid tokens, allowing for per-user tokens and token rotation.
After installing Ruby 2.3 and bundler, run
bundle install. If you don't have foreman, you may need a
gem install foreman. After that,
rake db:create and
rake db:migrate should get the database set up.
foreman s will start the server at
http://localhost:5000. If your token is
test, the link
http://localhost:5000/new-session/test will yield a logged-in session.