Neglected Pulse Machine

    nodemailer-mailjet-transport

    1.0.4 • Public • Published

    nodemailer-mailjet-transport

    A Mailjet transport for Nodemailer.

    Build Status Coverage Status Dependency Status devDependencies Status peerDependencies Status npm version Codacy Badge Known Vulnerabilities

    This module is a transport plugin for Nodemailer that makes it possible to send through Mailjet's Web API!

    Install

    npm install nodemailer-mailjet-transport
    

    Usage

    Quickstart

    'use strict';
    
    const nodemailer = require('nodemailer');
    const mailjetTransport = require('nodemailer-mailjet-transport');
    const transport = nodemailer.createTransport(mailjetTransport({
      auth: {
        apiKey: 'key',
        apiSecret: 'secret'
      }
    }));
    const mail = {
      from: 'john.doe@example.org',
      to: 'jane.doe@example.org',
      subject: 'Hello',
      text: 'Hello',
      html: '<h1>Hello</h1>'
    };
    
    try {
      const info = await transport.sendMail(mail);
      console.log(info);
    } catch (err) {
      console.error(err);
    }

    Using attachments

    'use strict';
    
    const nodemailer = require('nodemailer');
    const mailjetTransport = require('nodemailer-mailjet-transport');
    const transport = nodemailer.createTransport(mailjetTransport({
      auth: {
        apiKey: 'key',
        apiSecret: 'secret'
      }
    }));
    const mail = {
      from: 'john.doe@example.org',
      to: 'jane.doe@example.org',
      subject: 'Hello',
      text: 'Hello, This email contains attachments',
      html: '<h1>Hello, This email contains attachments</h1>',
      attachments: [
        {
          path: 'data:text/plain;base64,aGVsbG8gd29ybGQ=',
          cid: 'cid:molo.txt'
        }
      ]
    };
    
    try {
      const info = await transport.sendMail(mail);
      console.log(info);
    } catch (err) {
      console.error(err);
    }
    });

    License

    The MIT License (MIT)
    
    Copyright (c) Artem Grechko
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
    

    Install

    npm i nodemailer-mailjet-transport

    DownloadsWeekly Downloads

    141

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    29.6 kB

    Total Files

    12

    Last publish

    Collaborators

    • tuocs