Class SESTransport

Class Summary
Constructor Attributes Constructor Name and Description
 
SESTransport(options)

Generates a Transport object for Amazon SES

Possible options can be the following:

  • AWSAccessKeyID - AWS access key (required)
  • AWSSecretKey - AWS secret (required)
  • ServiceUrl - optional API endpoint URL (defaults to "https://email.us-east-1.amazonaws.com")

Method Summary

Class Detail

SESTransport(options)

Generates a Transport object for Amazon SES

Possible options can be the following:

  • AWSAccessKeyID - AWS access key (required)
  • AWSSecretKey - AWS secret (required)
  • ServiceUrl - optional API endpoint URL (defaults to "https://email.us-east-1.amazonaws.com")
Parameters:
{Object} options
Options object for the SES transport

Method Detail

  • {Array} buildKeyValPairs(config)

    Converts an object into a Array with "key=value" values

    Parameters:
    {Object} config
    Object with keys and values
    Returns:
    {Array} Array of key-value pairs
  • buildSignature(date, AWSSecretKey)

    Uses SHA-256 HMAC with AWS key on date string to generate a signature

    Parameters:
    {String} date
    ISO UTC date string
    {String} AWSSecretKey
    ASW secret key
  • generateMessage(emailMessage, callback)

    Compiles the messagecomposer object to a string.

    It really sucks but I don't know a good way to stream a POST request with unknown legth, so the message needs to be fully composed as a string.

    Parameters:
    {Object} emailMessage
    MailComposer object
    {Function} callback
    Callback function to run once the message has been compiled
  • handleMessage(email, callback)

    Compiles and sends the request to SES with e-mail data

    Parameters:
    {String} email
    Compiled raw e-mail as a string
    {Function} callback
    Callback function to run once the message has been sent
  • {String} ISODateString(d)

    Generates an UTC string in the format of YYY-MM-DDTHH:MM:SSZ

    Parameters:
    {Date} d
    Date object
    Returns:
    {String} Date string
  • responseHandler(callback, response)

    Handles the response for the HTTP request to SES

    Parameters:
    {Function} callback
    Callback function to run on end (binded)
    {Object} response
    HTTP Response object
  • sendMail(emailMessage, callback)

    Compiles a mailcomposer message and forwards it to handler that sends it.

    Parameters:
    {Object} emailMessage
    MailComposer object
    {Function} callback
    Callback function to run when the sending is completed
  • {String} strPad(n)

    Simple padding function. If the number is below 10, add a zero

    Parameters:
    {Number} n
    Number to pad with 0
    Returns:
    {String} 0 padded number