Skip to content

Hedi-Ayari/nodemailer-base64-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

nodemailer-base64-fix

A Node.js plugin for Nodemailer that fixes the issue of base64 images not displaying by converting them to CID-based inline attachments.

Installation

npm install nodemailer-base64-fix

Usage

const nodemailer = require('nodemailer');
const base64Fix = require('nodemailer-base64-fix');

let transporter = nodemailer.createTransport({
  // your transport options
  plugin: base64Fix({
    cidPrefix: 'image_'
  })
});

let mailOptions = {
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Subject',
  html: '<img src="data:image/png;base64,..."> Some content here'
};

transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    return console.log(error);
  }
  console.log('Message sent: %s', info.messageId);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published