ejsexton82 / serverless-ses-forwarder

Serverless Email Forwarding using AWS Lambda and SES

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serverless SES Forwarder

Serverless SemVer License

This is a simple, serverless email forwarder that uses Amazon Simple Email Service (Amazon SES). It was built using the Serverless framework, which is used to create an Amazon CloudFormation stack that includes most of the necessary assets.

Installation

Please review the Limitations of this project.

Amazon AWS

  1. In Amazon SES, verify the domains that you want to use to receive and forward emails.
  2. If you have a sandbox SES account, you must also verify the addresses to which you want to forward emails if those addresses are not included in verified domains.
  3. If you have not yet configured inbound email handling, you must create a new Rule Set. Otherwise, you can use an existing one.

SES Email Forwarder

  1. Rename config.example to config.js, and adjust the configuration.
  2. Rename env.example to env.yaml, and add the name of the Amazon SES Rule Set.
  3. Run sls deploy --stage prod.

Configuration

env.yaml

Rename env.example to env.yaml.

The env.yaml file provides the Amazon SES Rule Set Name that will be used by the Serverless Framework to create the Receipt Rule that will forward the email.

# Prod Stage
prod:
  ses:
    ruleSetName: live-rule-set

# If a stage is not specified, the default value is used.
default:
  ses:
    ruleSetName: default-rule-set

It is possible to specify different Rule Set Names for different stages, but only one Rule Set can be active at a time. It is usually easier to use the same Rule Set for every stage.

config.js

Rename config.example to config.js.

The config.js file specifies how emails should be forwarded.

module.exports = {
  default: {
    fromEmail: 'no-reply@verified.domain',
    forwardMapping: {
      '@sentto.example': [
        'address@forwardto.example',
      ],
    },
  },
};

It is possible to specify different configurations for different stages.

About

Limitations

SES Only Sends Emails from Verified Addresses and Domains

This script was designed to forward emails from any sender. In order to accomplish this, the From and Reply-To headers of the original message are modified to allow SES to send the email, but also to reflect the original sender.

So for a message sent from Some Guy <someguy@unverified.com> to info@verified.com, the From and Reply-To headers will be set to:

From: Some Guy <noreply@verified.com>
Reply-To: someguy@unverified.com

SES Only Receives Emails for Verified Addresses and Domains

Domains and addresses must first be verified before they can be used with this forwarder.

See Verifying Domains in Amazon SES.

SES Emails are Limited to 10 MB

This includes attachments after encoding.

See Limits in Amazon SES.

New SES Users Start in a Sandbox

Initially, all SES users start in a sandbox environment that has a number of limitations. Users must submit a support request to have their accounts removed from the sandbox.

See Limits in Amazon SES.

License

This project is licensed under the terms of the MIT license.

Credits

Shout outs to these talented developers:

About

Serverless Email Forwarding using AWS Lambda and SES

License:MIT License


Languages

Language:JavaScript 100.0%