Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
nodemailer-plugin-inline-base64
Advanced tools
This plugin will convert base64-encoded images in your nodemailer email to be inline ("CID-referenced") attachments within the email. Inline attachments are useful because them embed the image inside the actual email, so it's viewable even if the user is checking their email without an internet connection. But if you're OK with requiring that the user be online to see the image, then consider hosting your images from AWS Cloudfront using nodemailer-base64-to-s3.
Base64 images are generally a bad idea because they aren't supported in most email clients. This Nodemailer plugin will take base64 images in your email html in the form:
<img src="data:image/*;base64,...">
and replace it with a CID-referenced attachment that works in all email clients.
yarn add nodemailer-plugin-inline-base64
or
npm install nodemailer-plugin-inline-base64 --save
nodemailer-plugin-inline-base64
plugin:var inlineBase64 = require('nodemailer-plugin-inline-base64');
nodemailerTransport.use('compile', inlineBase64(options))
Options allow to set CID prefix1 {cidPrefix: 'somePrefix_'}
,
then all inline images will have prefix in cid, i.e.: cid:somePrefix_5fe3b631c651bdb1
. If you don't need this,
you can use inlineBase64 plugin without options.
var nodemailer = require('nodemailer');
var inlineBase64 = require('nodemailer-plugin-inline-base64');
transporter.use('compile', inlineBase64({cidPrefix: 'somePrefix_'}));
transporter.sendMail({
from: 'me@example.com',
to: 'hello@mixmax.com',
html: '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAACCAYAAACE7KJkAAAAI0lEQVRYR+3DMQ0AAAgDsKlFzZxgEhOcbdIEAIBf7Y6qqn8P0MMQZPno7TMAAAAASUVORK5CYII=">'
});
1 It might be useful for reply email processing, example with MailParser
mp.on("attachment", function(attachment, mail){
if (!attachment.contentId.includes('somePrefix')) { // process only images attached by user in reply
// ...
}
});
MIT
FAQs
Nodemailer plugin that will inline base64 images
The npm package nodemailer-plugin-inline-base64 receives a total of 6,940 weekly downloads. As such, nodemailer-plugin-inline-base64 popularity was classified as popular.
We found that nodemailer-plugin-inline-base64 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.