Nighttime Peanut Migrations

    send-email

    1.1.3 • Public • Published

    send-email

    Easily send email using any major email service provider like AWS SES, SendGrid or Gmail

    It uses Nodemailer to send email. They've support for several well-known providers

    Install

    npm install send-email

    Environment Variables

    SEND_EMAIL_SERVICE_PROVIDER=SES-US-EAST-1
    SEND_EMAIL_AUTH_USER=AKIAJLQWEFTYNLFGRQDIG
    SEND_EMAIL_AUTH_PASS=Arfk/T8SgGvCtY7Rdq7VOsdjhjDHHOD4F8p36HEWhZl
    

    Usage

    const sendEmail = require('send-email')
     
    let payload = {
        "to": "test@email.com",
        "subject": "sending emails using send-email",
        // "text": "hello world!",
        "html": "hello <b>world</b>!",
        "from": "Myself <myself@domain.com>"
    }
    sendEmail(payload)
        .then((res) => {
            console.log(res);
        })

    Note

    If you are using dotenv to set environment variables dynamically then you need to call require('dotenv').config() before importing send-email.

    const dotenv = require('dotenv');
    dotenv.config();
     
    const sendEmail = require('send-email')

    Since we are using SMTP protocol its little bit slower than using service provider API

    Todo

    • Credentials in Environment variables & check it
    • SES API ?
    • Handle Errors properly.

    Inspiration

    Now Emails

    License

    MIT © Ashik Nesin

    Install

    npm i send-email

    DownloadsWeekly Downloads

    22

    Version

    1.1.3

    License

    MIT

    Last publish

    Collaborators

    • avatar