blackboard-send-mail

Send e-mails from Node.js – easy as Peeled bananas! 🍌✉️

Usage no npm install needed!

<script type="module">
  import blackboardSendMail from 'https://cdn.skypack.dev/blackboard-send-mail';
</script>

README

blackboard-send-mail

Send e-mails from Node.js – easy as Peeled bananas! 🍌✉️

npm version

NPM

Installation

$ npm install blackboard-send-mail

or

$ yarn add blackboard-send-mail

Importing

// Using Node.js `require()`
const bsm = require('blackboard-send-mail');

Overview

Connecting to Mail

First, we need to define a connection mail service. bsm.connect

bsm.connect({
    host: "HOST_MAIL_DOMAIN",
    auth: {
        user:"EMAIL_DOMAIN",
        pass: "PASSWORD"
    }
})

Send Email

bsm.sendMail({
    from: '"Fred Foo 👻" <foo@example.com>', // sender address
    to: "bar@example.com, baz@example.com", // list of receivers
    subject: "Hello ✔", // Subject line
    text: "Hello world?", // plain text body
    html: "<b>Hello world?</b>", // html body
  }).then(info => {
       console.log("Message sent: %s", info.messageId);
  // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>
  });