Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 855 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 855 Bytes

CRAM-MD5 authentication for Nodemailer

Nodemailer 5+ allows to use custom authentication mechanisms. While there is no support in Nodemailer for CRAM-MD5 then it can be provided with an addon.

Install

Requires Nodejs v8.0.0 or newer

npm install nodemailer-cram-md5

Usage

const nodemailer = require('nodemailer');
const nodemailerCramMd5 = require('nodemailer-cram-md5');

let transporter = nodemailer.createTransport({
    host: 'smtp.example.com',
    port: 465,
    secure: true,
    auth: {
        type: 'custom',
        method: 'CRAM-MD5',
        user: 'username',
        pass: 'verysecret'
    },
    customAuth: {
        'CRAM-MD5': nodemailerCramMd5
    }
});

transporter.sendMail({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'hello world!',
    text: 'hello!'
}, console.log)