Videofy Email Handler

Logic that binds the Amazon SQS (Simple Queue Service) to the Amazon SES (Simple Email Service)

The handler will poll a specified SQS Queue and translate the messages to somethign that SES can understand and then push them to SES; effectively sending the emails.

The SQS message should look something like this:

{
   "from": "SES verified email <[email protected]>",
   "to": "Person <[email protected]>",
   "subject": "Subject of the email",
   "html": "<p> A little email </p>"
}

There are ofcourse a bunch of other fields that can be used, check the code for more info.

Get up and running with the mail handler

To start with there are some dependencies that must be satisfied.

  • Ruby ( >= 2.1.2) must be installed on the host computer
  • Rubygems (>= 1.8) to install the gem

To install just type gem install vf-email-handler and you're set to go.

To build the gem from source hit rake gem:build and that will build the gem and install it.

Then there is just the matter of writing the config, which of course the handler can do for you; at least get you started. Type the following:

vf-email-handler create-config

and it will generate a config-skeleton for you. Looking inside mailer_config.yml we se this:

:aws:
  :ses:
    :access_key_id: <YOUR AWS ACCESS_KEY_ID>
    :secret_access_key: <YOUR AWS SECRET_ACCESS_KEY>
    :ses_server: email.eu-west-1.amazonaws.com
  :sqs:
    :access_key_id: <YOUR AWS ACCESS_KEY_ID>
    :secret_access_key: <YOUR AWS SECRET_ACCESS_KEY>
    :sqs_queues: [<NAMES OF YOUR AWS SQS QUEUES>]
    :aws_region: eu-west-1
    :batch_size: <OPTIONAL DEFAULT 1 MAX 10>

:logger:
  :log_file: <PATH TO LOGFILE HERE; Null if STOUT>

Fill in the blanks and then start the handler by running.

vf-email-handler run mailer_config.yml

Happy hacking!