Coder Social home page Coder Social logo

gellin / aws_lambda_ses_sendrawemail-node Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 3.0 3 KB

An asynchronous invokable microservice running on AWS-Lambda Node.js, programmed to send batches of emails with an attachment.

License: MIT License

JavaScript 100.00%
aws aws-lambda-node aws-ses mass-emailer node-js microservice

aws_lambda_ses_sendrawemail-node's Introduction

lambda_node_ses_email_forwarder_sendrawemail

  • The goal for this project is to provide a backend for sending out e-mails (with an attachment) using Amazon SES, running on AWS Lambda + Node.JS
  • This code only supports 50 recipients, a recipient is any to/cc/bcc address.
  • If you do not need attachments checkout this version instead - lambda sendemail ses

Useage

Input event data

  • to / cc / bcc - You must use atleast one of these
  • subject - The subject line
  • html - The html version of the email body
  • text - The text version of the email body
  • from - Your verified sender address
  • attachments - supports multiple in mailcomposer format
{
  "to": [
    "[email protected]",
    "[email protected]"
  ],
  "bcc": [
    "[email protected]",
    "[email protected]"
  ],
  "cc": [
    "[email protected]",
    "[email protected]"
  ],
  "subject": "λ SES Node Test λλλ",
  "html": "<br><h1>Hello world!!!!!</h1> - from lambda",
  "text": "Hello world!!!!! - from lambda",
  "from": "YOUR_VERIFIED_SENDER_ADDRESS",
  "attachments": [
    {
      "filename": "test.jpg",
      "path": "http://www.example.com/sample.jpg"
    }
  ]
}

Installation & Setup

  1. Save the code to your computer, and extract it to a new folder
  2. Initialize the node directory - install mailcomposer - npm install mailcomposer
  3. Compress the index.js and node_modules folder into a zip file.
  4. Create a new lambda function using Node.js runtime, upload the zip file as the source code, and create a new IAM access role with the following policy
{  
   "Version":"2012-10-17",
   "Statement":[  
      {  
         "Effect":"Allow",
         "Action":[  
            "logs:CreateLogGroup",
            "logs:CreateLogStream",
            "logs:PutLogEvents"
         ],
         "Resource":"arn:aws:logs:*:*:*"
      },
      {  
         "Effect":"Allow",
         "Action":[  
            "ses:SendRawEmail"
         ],
         "Resource":"*"
      }
   ]
}

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.