0.2.3 • Published 2 years ago

@techie04/xpresser-mailer v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

XpresserJs Mailer Plugin

Build Status License npm version

A library to help you send mails.

This plugin makes use of nodemailer and aws-sdk ses.

MENU

Installation

npm i @techie04/xpresser-mailer

# OR
yarn add @techie04/xpresser-mailer

Add to plugins.json

{
  "npm://@techie04/xpresser-mailer": true
}

Add to your project config.

({
  // SMTP CONFIG
    "mailer": {
        provider: "SMTP", // SMTP
        host: "", // SMTP Server Host
        port: "", // SMTP Server Port
        username: "", // SMTP Server Username
        password: "", // SMTP Server Password
        fromEmail: "no-reply@example.com" // From email
    },

    // AWS CONFIG
    "mailer": {
        provider: "AWS", // AWS
        region: "", // AWS Server Region
        fromEmail: "no-reply@example.com", // From email
        // AWS credentials
        AWS_ACCESS_KEY_ID: "",
        AWS_SECRET_ACCESS_KEY: ""
    },
  
})

Usage

In your controller or anywhere in your project.

const { sendMail } = require("@techie04/xpresser-mailer");

(async () => {
    
    // array of attachments 
    const attachments = [
        {
            // filename (optional)
            filename: "techieoriname.png",
            // file path or url
            path: path.join(__dirname, "..", "TechieOriname.png")
        }
    ]
    
    await sendMail(
        "example@example.com", // to email
        "testing subject", // message subject
        "my message here", // message body
        "text", // message format ("html" or "text")
        attachments // optional field
    );
});

Typescript support

import { AttachmentType, sendMail } from "@techie04/xpresser-mailer";

// array of attachments 
const attachments: AttachmentType[] = [
    {
        // filename (optional)
        filename: "techieoriname.png",
        // file path or url
        path: path.join(__dirname, "..", "TechieOriname.png")
    }
];

await sendMail(
    "example@example.com",
    "testing subject",
    "my message here",
    "text",
    attachments // optional field
);
0.3.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.1

2 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago