Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smtp-mailer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-mailer

Mailazy NodeJs SDK Client

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 21 Jun 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc