Reputation: 25
I'm facing an issue with emailjs-mime-builder
Code
var MimeBuilder = require('emailjs-mime-builder')
var rootNode = new MimeBuilder("multipart/mixed"),
childNodeTxt = rootNode.createChild("text/plain").setContent("Text");
childNodeHtml = rootNode.createChild("text/html").setContent("<h1>HTML</h1>");
rootNode.build()
Error
MimeBuilder is not a constructor
Upvotes: 0
Views: 446
Reputation: 1512
The emailjs-mime-builder
package is an ES6 Module. Meaning that if you can't use import
like for example within a node.js
enviornment, you have to require
it like this instead:
const { default: MimeBuilder } = require( 'emailjs-mime-builder' );
Upvotes: 1