Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 985 Bytes

README.md

File metadata and controls

36 lines (26 loc) · 985 Bytes

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 protected]", 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&[email protected]"