@joystick.js/node

Configuring Sends

How to configure email sending via your settings..json file.

To send email with Joystick, you will need to configure an SMTP provider in your settings.<env>.json file.

Example Usage

settings.<env>.json

{
  "config": {
    "databases": [
      {
        "provider": "mongodb",
        "users": true,
        "options": {}
      }
    ],
    "i18n": {
      "defaultLanguage": "en-US"
    },
    "middleware": {},
    "email": {
      "from": "<default_from_email_address>",
      "smtp": {
        "host": "<smtp_host>",
        "port": 587,
        "username": "<smtp_username>",
        "password": "<smtp_password>"
      }
    }
  },
  "global": {},
  "public": {},
  "private": {}
}

Above, we add an email parameter to the existing config object in our settings.<env>.json file. Here, we can configure:

  • from - The default email address that emails will be sent from if a from address is not provided at send time.
  • smtp.host - The hostname for your SMTP service.
  • smtp.port - The port for your SMTP service (defaults to 587 for TLS).
  • smtp.username - The username for your SMTP service.
  • smtp.password - The password for your SMTP service.

If set to a valid SMTP provider, emails sent via calls to email.send() will be relayed through this SMTP server.

API

Definition

email: {
  from: string,
  smtp: {
    host: string,
    port: number,
    username: string,
    password: string
  }
}

Parameters

from string required
The default email address that emails will be sent from if no from address is provided at send time.
smtp object required
SMTP configuration for sending email.
host string required
The hostname for your SMTP server.
port number required
The port number for your SMTP server (commonly 587 for TLS or 465 for SSL).
username string required
The username to authenticate with your SMTP server.
password string required
The password to authenticate with your SMTP server.