Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emailjs-mime-builder

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emailjs-mime-builder - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

13

dist/builder.js

@@ -94,2 +94,7 @@ 'use strict';

}
/**
* If true then BCC header is included in RFC2822 message.
*/
this.includeBccInHeader = options.includeBccInHeader || false;
}

@@ -408,4 +413,6 @@

case 'Bcc':
// skip BCC values
return;
if (_this4.includeBccInHeader === false) {
// skip BCC values
return;
}
}

@@ -534,2 +541,2 @@

exports.default = MimeNode;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9idWlsZGVyLmpzIl0sIm5hbWVzIjpbIk1pbWVOb2RlIiwiY29udGVudFR5cGUiLCJvcHRpb25zIiwibm9kZUNvdW50ZXIiLCJiYXNlQm91bmRhcnkiLCJEYXRlIiwibm93IiwidG9TdHJpbmciLCJNYXRoIiwicmFuZG9tIiwiZGF0ZSIsInJvb3ROb2RlIiwiZmlsZW5hbWUiLCJzcGxpdCIsInBvcCIsInBhcmVudE5vZGUiLCJfbm9kZUlkIiwiX2NoaWxkTm9kZXMiLCJfaGVhZGVycyIsInNldEhlYWRlciIsIm5vZGUiLCJhcHBlbmRDaGlsZCIsImNoaWxkTm9kZSIsInB1c2giLCJmb3JFYWNoIiwiaSIsInVuZGVmaW5lZCIsImxlbmd0aCIsInNwbGljZSIsImtleSIsInZhbHVlIiwiYWRkZWQiLCJBcnJheSIsImlzQXJyYXkiLCJPYmplY3QiLCJrZXlzIiwiaGVhZGVyVmFsdWUiLCJsZW4iLCJhZGRIZWFkZXIiLCJjb250ZW50IiwibGluZXMiLCJnZXRIZWFkZXIiLCJ0b0xvd2VyQ2FzZSIsInRyaW0iLCJ0cmFuc2ZlckVuY29k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VuYW1lID0gdGhpcy5maWxlbmFtZVxuICAgICAgICAgIH1cbiAgICAgICAgICB2YWx1ZSA9IGJ1aWxkSGVhZGVyVmFsdWUoc3RydWN0dXJlZClcbiAgICAgICAgICBicmVha1xuICAgICAgICBjYXNlICdDb250ZW50LVR5cGUnOlxuICAgICAgICAgIHN0cnVjdHVyZWQgPSBwYXJzZUhlYWRlclZhbHVlKHZhbHVlKVxuXG4gICAgICAgICAgdGhpcy5fYWRkQm91bmRhcnkoc3RydWN0dXJlZClcblxuICAgICAgICAgIGlmIChmbG93ZWQpIHtcbiAgICAgICAgICAgIHN0cnVjdHVyZWQucGFyYW1zLmZvcm1hdCA9ICdmbG93ZWQnXG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChTdHJpbmcoc3RydWN0dXJlZC5wYXJhbXMuZm9ybWF0KS50b0xvd2VyQ2FzZSgpLnRyaW0oKSA9PT0gJ2Zsb3dlZCcpIHtcbiAgICAgICAgICAgIGZsb3dlZCA9IHRydWVcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoc3RydWN0dXJlZC52YWx1ZS5tYXRjaCgvXnRleHRcXC8vKSAmJiB0eXBlb2YgdGhpcy5jb250ZW50ID09PSAnc3RyaW5nJyAmJiAvW1xcdTAwODAtXFx1RkZGRl0vLnRlc3QodGhpcy5jb250ZW50KSkge1xuICAgICAgICAgICAgc3RydWN0dXJlZC5wYXJhbXMuY2hhcnNldCA9ICd1dGYtOCdcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IGJ1aWxkSGVhZGVyVmFsdWUoc3RydWN0dXJlZClcbiAgICAgICAgICBicmVha1xuICAgICAgICBjYXNlICdCY2MnOlxuICAgICAgICAgIC8vIHNraXAgQkNDIHZhbHVlc1xuICAgICAgICAgIHJldHVyblxuICAgICAgfVxuXG4gICAgICAvLyBza2lwIGVtcHR5IGxpbmVzXG4gICAgICB2YWx1ZSA9IGVuY29kZUhlYWRlclZhbHVlKGtleSwgdmFsd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bG9wZVxuICB9XG5cbiAgLyoqXG4gICAqIENoZWNrcyBpZiB0aGUgY29udGVudCB0eXBlIGlzIG11bHRpcGFydCBhbmQgZGVmaW5lcyBib3VuZGFyeSBpZiBuZWVkZWQuXG4gICAqIERvZXNuJ3QgcmV0dXJuIGFueXRoaW5nLCBtb2RpZmllcyBvYmplY3QgYXJndW1lbnQgaW5zdGVhZC5cbiAgICpcbiAgICogQHBhcmFtIHtPYmplY3R9IHN0cnVjdHVyZWQgUGFyc2VkIGhlYWRlciB2YWx1ZSBmb3IgJ0NvbnRlbnQtVHlwZScga2V5XG4gICAqL1xuICBfYWRkQm91bmRhcnkgKHN0cnVjdHVyZWQpIHtcbiAgICB0aGlzLmNvbnRlbnRUeXBlID0gc3RydWN0dXJlZC52YWx1ZS50cmltKCkudG9Mb3dlckNhc2UoKVxuXG4gICAgdGhpcy5tdWx0aXBhcnQgPSB0aGlzLmNvbnRlbnRUeXBlLnNwbGl0KCcvJykucmVkdWNlKGZ1bmN0aW9uIChwcmV2LCB2YWx1ZSkge1xuICAgICAgcmV0dXJuIHByZXYgPT09ICdtdWx0aXBhcnQnID8gdmFsdWUgOiBmYWxzZVxuICAgIH0pXG5cbiAgICBpZiAodGhpcy5tdWx0aXBhcnQpIHtcbiAgICAgIHRoaXMuYm91bmRhcnkgPSBzdHJ1Y3R1cmVkLnBhcmFtcy5ib3VuZGFyeSA9IHN0cnVjdHVyZWQucGFyYW1zLmJvdW5kYXJ5IHx8IHRoaXMuYm91bmRhcnkgfHwgZ2VuZXJhdGVCb3VuZGFyeSh0aGlzLl9ub2RlSWQsIHRoaXMucm9vdE5vZGUuYmFzZUJvdW5kYXJ5KVxuICAgIH0gZWxzZSB7XG4gICAgICB0aGlzLmJvdW5kYXJ5ID0gZmFsc2VcbiAgICB9XG4gIH1cbn1cbiJdfQ==
{
"name": "emailjs-mime-builder",
"version": "2.0.2",
"version": "2.0.3",
"homepage": "https://github.com/emailjs/emailjs-mime-builder",

@@ -36,3 +36,3 @@ "description": "emailjs-mime-builder is a low level rfc2822 message composer. Define your own mime tree, no magic included.",

"chai": "^4.1.2",
"mocha": "^4.0.1",
"mocha": "^5.0.0",
"pre-commit": "^1.2.2",

@@ -46,4 +46,4 @@ "standard": "^10.0.3"

"before",
"beforeAll",
"afterAll",
"beforeEach",
"afterEach",
"after",

@@ -50,0 +50,0 @@ "expect"

@@ -250,3 +250,3 @@ /* eslint-disable no-unused-expressions */

it('should not inclide bcc missing in output, but in envelope', function () {
it('should not include bcc in output, but in envelope', function () {
const mb = new Mimebuilder('text/plain')

@@ -271,2 +271,22 @@ .setHeader({

it('should include bcc in output, and in envelope', function () {
const mb = new Mimebuilder('text/plain', {includeBccInHeader: true})
.setHeader({
from: 'sender@example.com',
to: 'receiver@example.com',
bcc: 'bcc@example.com'
})
const msg = mb.build()
const envelope = mb.getEnvelope()
expect(envelope).to.deep.equal({
from: 'sender@example.com',
to: ['receiver@example.com', 'bcc@example.com']
})
expect(/^From: sender@example.com$/m.test(msg)).to.be.true
expect(/^To: receiver@example.com$/m.test(msg)).to.be.true
expect(/^Bcc: bcc@example.com$/m.test(msg)).to.be.true
})
it('should have unicode subject', function () {

@@ -273,0 +293,0 @@ const msg = new Mimebuilder('text/plain')

@@ -89,2 +89,7 @@ import {

}
/**
* If true then BCC header is included in RFC2822 message.
*/
this.includeBccInHeader = options.includeBccInHeader || false
}

@@ -357,4 +362,6 @@

case 'Bcc':
// skip BCC values
return
if (this.includeBccInHeader === false) {
// skip BCC values
return
}
}

@@ -361,0 +368,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc