Socket
Socket
Sign inDemoInstall

smtp-mailer

Package Overview
Dependencies
7
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    smtp-mailer

Mailazy NodeJs SDK Client


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

NodeJS SMTP Email API SDK

Mailazy NodeJs SDK Client

Table of Contents

  • Install
  • Usage
  • License

Install

Prerequisites

Generate Access Keys

You need a sender/domain authenticated account in order to generate Access Keys from the Mailazy Console

Install Package

npm:

npm install smtp-mailer

yarn:

yarn add smtp-mailer

Usage

Email API

const MailazyClient = require('smtp-mailer');
const client = new MailazyClient({
    serviceType: "API", //SMTP,API
    auth: {
        user: '___mailazy_access_key___',
        pass: '___mailazy_access_secret___'
    }
});

const fn = async () => {
    try {
        const resp = await client.send({
           from: "example@domain.com", // required, Use domain you verified
           to: "test@example.com", // required, user comma (,) for multiple recipients
           cc: "cc@domain.com", // optional, user comma (,) for multiple recipients
           bcc: "bcc@domain.com", // optional, user comma (,) for multiple recipients
           reply_to: "reply@domain.com", // optional
           subject: 'test email from node.js app with attachment', // required
           text: 'hello world!', // required
           html: '<b>hello world</b>', // required
           attachments: [ // optional
           {
               filename: 'hello.csv',
               path: path.join(__dirname, `hello.csv`),
               contentType: 'application/octet-stream'
           }
           ]
      });
        console.log('resp: ' + resp);
    } catch (e) {
        console.log('error: ' + e);
    }
};
fn();

SMTP

const MailazyClient = require('smtp-mailer');
const client = new MailazyClient({
    serviceType: "SMTP", //SMTP,API
    auth: {
        user: '___mailazy_access_key___',
        pass: '___mailazy_access_secret___'
    }
});

const fn = async () => {
    try {
        const resp = await client.send({
           from: "example@domain.com", // required, Use domain you verified
           to: "test@example.com", // required, user comma (,) for multiple recipients
           cc: "cc@domain.com", // optional, user comma (,) for multiple recipients
           bcc: "bcc@domain.com", // optional, user comma (,) for multiple recipients
           reply_to: "reply@domain.com", // optional
           subject: 'test email from node.js app with attachment', // required
           text: 'hello world!', // required
           html: '<b>hello world</b>', // required
           attachments: [ // optional
           {
               filename: 'hello.csv',
               path: path.join(__dirname, `hello.csv`),
               contentType: 'application/octet-stream'
           }
           ]
      });
        console.log('resp: ' + resp);
    } catch (e) {
        console.log('error: ' + e);
    }
};
fn();

License

MIT © Mailazy

Keywords

FAQs

Last updated on 21 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc