Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Node.js Lambda function that utilizes Amazon SES to forward incoming emails to an email address inbox. Setup Amazon SES to receive emails and deliver to a S3 bucket, then invoke lambda to forward the email to your email of choice.

Notifications You must be signed in to change notification settings

Mirakurun/aws-lambda-ses-s3-email-forwarder

Repository files navigation

AWS Lambda SES S3 Email Forwarder

A Node.js Lambda function that utilizes Amazon SES to forward incoming emails to an email address inbox. Setup Amazon SES to receive emails and deliver to a S3 bucket, then invoke lambda to forward the email to your email of choice.

Architecture Diagram

Diagram

Features

  • Serverless... no servers required because of Lambda.
  • Cheap... can cost as low as a few cents.
  • Parse email attachments. Saves attachments to S3 and insert download links into email. Avoid SES email size limitations.
    • Receiving email: 30 MB
    • Sending email: 10 MB

Requirements

  1. Domain name
  2. AWS account
  3. Unsanboxed Amazon SES account
  4. Verify your domain

Installation

npm install

Configuration

Create the following file inside the config folder.

config.js

exports.config = {
 attachmentPrefix: 'attachments/', // Attachment folder
 bucket: '', // S3 bucket
 cloudFront: '', // CloudFront distribtion domain name for S3 bucket (optional and you must setup this yourself first)
 forwardTo: [], // Email address destination
 from: '', // The email address that is sending the email.
 keyPrefix: 'email/', // Key prefix for S3 bucket
 region: '', // The region to send service requests to (not required if using CloudFront)
 sendingRate: 1, // How many messages per second is allowed to be delivered to SES
};

Packaging

serverless package

Deployment

serverless deploy --package .serverless

Setup Email Receiving

SES Rule set

Create a receipt rule set

  1. Create recipients
  2. Create 2 actions in this exact order. S3 first, then Lambda.
    1. S3 action
      • S3 bucket - The name of the Amazon S3 bucket to which to save received emails.
      • Object key prefix - A key name prefix to use within the Amazon S3 bucket. (for example, email/)
      • Uncheck encrypt message (NOT RECOMMENDED because S3 client-side encryption is currently not supported for JavaScript. See documentation)
      • SNS Topic - Choose "None"
    2. Lambda action
      • Lambda function: Choose the function that you created during deployment.
      • Invocation type: Choose "Event"
      • SNS Topic - Choose "None"

About

A Node.js Lambda function that utilizes Amazon SES to forward incoming emails to an email address inbox. Setup Amazon SES to receive emails and deliver to a S3 bucket, then invoke lambda to forward the email to your email of choice.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /