Antwort CLI for E-Mail Generation

View source on GitHub  →

Challenge

Creating rich emails requires extensive templating via HTML <table>s and inlining CSS - an exhaustive process.

Solution

Create a CLI to autogenerate HTML with inlined CSS from minimal templates to allow developers to focus on value generation.

bundle exec antwort build newsletter

Commands

N.B. EMAIL_ID corresponds to a filename in the emails/ folder.

Commands:
  antwort build EMAIL_ID               # Builds email markup and inlines CSS from source
  antwort help [COMMAND]               # Describe available commands or one specific command
  antwort init PROJECT_NAME            # Initializes a new Antwort Email project
  antwort list                         # Lists all emails in the ./emails directory by id
  antwort new EMAIL_ID                 # Creates a new email template
  antwort prune                        # Removes all files in the ./build directory
  antwort send EMAIL_ID                # Sends built email via SMTP
  antwort server                       # Starts http://localhost:9292 server for coding and previewing emails
  antwort upload EMAIL_ID              # Uploads email assets to AWS S3
  antwort version                      # ouputs version number

File structure

.
+-- .env
+-- build
+-- assets
|   +-- css
|   +-- images
+-- emails
+-- views
+-- tmp

Configuration

Configuration is stored in a local .env file that should not be checked into git.

ASSET_SERVER:           https://example.s3.amazonaws.com
AWS_ACCESS_KEY_ID:      {{aws_access_key_id}}
AWS_SECRET_ACCESS_KEY:  {{aws_secret_access_key}}
AWS_BUCKET:             example
FOG_REGION:             eu-west-1

SMTP_SERVER:            smtp.mandrillapp.com
SMTP_PORT:              587
SMTP_USERNAME:          {{username}}
SMTP_PASSWORD:          {{password}}
SMTP_DOMAIN:            {{domain}}
SEND_TO:                {{default_recipient}}
SEND_FROM:              {{default_sender}}

Date

2015

URL

github.com/julie-ng/antwort-cli

Project Type

CLI Tool

Skills

  • Ruby
  • Automation