1.0.0 • Published 1 year ago
nodemailer-base64-fix v1.0.0
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: 'sender@example.com',
to: 'recipient@example.com',
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);
});
1.0.0
1 year ago