skojin / send-gmail-lambda

AWS lambda send Gmail email microservice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

send-gmail-lambda

Small simple AWS lambda REST microservice that send email via Gmail

Setup

git clone https://github.com/skojin/send-gmail-lambda.git
cd send-gmail-lambda
npm install
bundle install
cp config.rb.example config.rb

Get gmail oauth credential using this guide, and save them to config.rb

Deploy to AWS lambda with Serverless Framework

serverless deploy

Remember endpoint URL from deploy command output

Invoke

  # ruby
  Net::HTTP.post_form(
    URI("https://XXX.execute-api.us-east-1.amazonaws.com/dev/send/some-random-secure-key"),
    {to: "email@example.com", subject: 'SUBJECT' body: 'TEXT BODY'})
curl -X POST "https://XXX.execute-api.us-east-1.amazonaws.com/dev/send/some-random-secure-key" -d "subject=SUBJECT&body=BODY&to=email@example.com"

About

AWS lambda send Gmail email microservice

License:MIT License


Languages

Language:Ruby 94.2%Language:Makefile 5.8%