damless-nodemailer

Nodemailer service for damless.

Usage no npm install needed!

<script type="module">
  import damlessNodemailer from 'https://cdn.skypack.dev/damless-nodemailer';
</script>

README

damless-nodemailer

Use nodemailer to send email from your Dam Less server.

Features

Add the nodemailer parameters in config.json

{
  "nodemailer": {
    "transport": {
      "service": "service name",
      "auth": {
        "user": "user",
        "pass": "password"
      }
    },
    "dkim": {
      "domainName": "your domain.com",
      "keySelector": "123456",
      "privateKey": "./key.pem"
    },
    "from": "your e-mail address"
}

Declare and inject nodemailer service

const DamLess = require("damless");
const damless = new DamLess();

damless.inject("mailer", "damless-nodemailer");

API

  • send(mailerOptions)
const mailOptions = {
    from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address 
    to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers 
    subject: 'Hello ✔', // Subject line 
    text: 'Hello world ✔', // plaintext body 
    html: '<b>Hello world ✔</b>' // html body 
};

return mailer.send(mailOptions);

Installation

$ npm install damless-nodemailer