Skip to content
A lambda function to send emails by lambda invoke
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore setup function Dec 14, 2017
EmailService.js
LICENSE
README.md
handler.js
package-lock.json
package.json
serverless.yml

README.md

Serverless Node Mailer

A lambda function to send emails by lambda invoke with handlebars support.

Deploy

git clone https://github.com/svtek/serverless-node-mailer.git
cd serverless-node-mailer
serverless deploy -s prod

Ruby Invoke Example

  client = Aws::Lambda::Client.new

  req_payload = {
    options:   { email_from: 'test@example.com', email_to: 'to-test@example.com' }.to_json,
    variables: { name: 'John', click_url: 'https://example.com' }.to_json,
    smtp:      { address: 'smtp.gmail.com', port: "465", username: 'test', password: 'test' }.to_json,
    subject:   "Hi {{name}}! This is an email subject!",
    content:   "<p>HTML template with handlebars support. <a href="{{click_url}}">Click here</a></p>"
  }

  @payload = JSON.generate(req_payload)

  resp = client.invoke({
    function_name: 'serverless-node-mailer-prod-notifier',
    invocation_type: 'RequestResponse',
    log_type: 'None',
    payload: @payload
  })

Payload options also support: cc, bcc and reply_to.

You can’t perform that action at this time.