emailjs 3.3.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -1
- package/README.md +43 -1
- package/package.json +27 -22
- package/rollup/email.cjs +217 -168
- package/rollup/email.cjs.map +1 -1
- package/rollup/email.mjs +222 -174
- package/rollup/email.mjs.map +1 -1
- package/smtp/client.ts +29 -12
- package/smtp/connection.ts +48 -50
- package/smtp/date.ts +16 -0
- package/smtp/message.ts +137 -99
- package/smtp/mime.ts +2 -3
package/rollup/email.cjs
CHANGED
|
@@ -256,6 +256,19 @@ function getRFC2822DateUTC(date = new Date()) {
|
|
|
256
256
|
dates.push('+0000');
|
|
257
257
|
return dates.join(' ');
|
|
258
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* RFC 2822 regex
|
|
261
|
+
* @see https://tools.ietf.org/html/rfc2822#section-3.3
|
|
262
|
+
* @see https://github.com/moment/moment/blob/a831fc7e2694281ce31e4f090bbcf90a690f0277/src/lib/create/from-string.js#L101
|
|
263
|
+
*/
|
|
264
|
+
const rfc2822re = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
|
|
265
|
+
/**
|
|
266
|
+
* @param {string} [date] a string to check for conformance to the [rfc2822](https://tools.ietf.org/html/rfc2822#section-3.3) standard
|
|
267
|
+
* @returns {boolean} the result of the conformance check
|
|
268
|
+
*/
|
|
269
|
+
function isRFC2822Date(date) {
|
|
270
|
+
return rfc2822re.test(date);
|
|
271
|
+
}
|
|
259
272
|
|
|
260
273
|
// adapted from https://github.com/emailjs/emailjs-mime-codec/blob/6909c706b9f09bc0e5c3faf48f723cca53e5b352/src/mimecodec.js
|
|
261
274
|
const encoder = new util.TextEncoder();
|
|
@@ -267,7 +280,7 @@ const RANGES = [
|
|
|
267
280
|
[0x0a],
|
|
268
281
|
[0x0d],
|
|
269
282
|
[0x20, 0x3c],
|
|
270
|
-
[0x3e, 0x7e],
|
|
283
|
+
[0x3e, 0x7e], // >?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}
|
|
271
284
|
];
|
|
272
285
|
const LOOKUP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
|
273
286
|
const MAX_CHUNK_LENGTH = 16383; // must be multiple of 3
|
|
@@ -444,7 +457,7 @@ function mimeWordEncode(data, mimeWordEncoding = 'Q', encoding = 'utf-8') {
|
|
|
444
457
|
.trim();
|
|
445
458
|
}
|
|
446
459
|
|
|
447
|
-
const CRLF = '\r\n';
|
|
460
|
+
const CRLF$1 = '\r\n';
|
|
448
461
|
/**
|
|
449
462
|
* MIME standard wants 76 char chunks when sending out.
|
|
450
463
|
*/
|
|
@@ -458,7 +471,7 @@ const MIME64CHUNK = (MIMECHUNK * 6);
|
|
|
458
471
|
*/
|
|
459
472
|
const BUFFERSIZE = (MIMECHUNK * 24 * 7);
|
|
460
473
|
let counter = 0;
|
|
461
|
-
function
|
|
474
|
+
function generateBoundary() {
|
|
462
475
|
let text = '';
|
|
463
476
|
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'()+_,-./:=?";
|
|
464
477
|
for (let i = 0; i < 69; i++) {
|
|
@@ -556,30 +569,32 @@ class Message {
|
|
|
556
569
|
}
|
|
557
570
|
/**
|
|
558
571
|
* @public
|
|
559
|
-
* @
|
|
560
|
-
* @returns {void}
|
|
572
|
+
* @returns {{ isValid: boolean, validationError: (string | undefined) }} an object specifying whether this message is validly formatted, and the first validation error if it is not.
|
|
561
573
|
*/
|
|
562
|
-
|
|
574
|
+
checkValidity() {
|
|
563
575
|
if (typeof this.header.from !== 'string' &&
|
|
564
576
|
Array.isArray(this.header.from) === false) {
|
|
565
|
-
|
|
577
|
+
return {
|
|
578
|
+
isValid: false,
|
|
579
|
+
validationError: 'Message must have a `from` header',
|
|
580
|
+
};
|
|
566
581
|
}
|
|
567
|
-
|
|
582
|
+
if (typeof this.header.to !== 'string' &&
|
|
568
583
|
Array.isArray(this.header.to) === false &&
|
|
569
584
|
typeof this.header.cc !== 'string' &&
|
|
570
585
|
Array.isArray(this.header.cc) === false &&
|
|
571
586
|
typeof this.header.bcc !== 'string' &&
|
|
572
587
|
Array.isArray(this.header.bcc) === false) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
588
|
+
return {
|
|
589
|
+
isValid: false,
|
|
590
|
+
validationError: 'Message must have at least one `to`, `cc`, or `bcc` header',
|
|
591
|
+
};
|
|
577
592
|
}
|
|
578
|
-
|
|
593
|
+
if (this.attachments.length > 0) {
|
|
579
594
|
const failed = [];
|
|
580
595
|
this.attachments.forEach((attachment) => {
|
|
581
596
|
if (attachment.path) {
|
|
582
|
-
if (fs.existsSync(attachment.path)
|
|
597
|
+
if (fs.existsSync(attachment.path) === false) {
|
|
583
598
|
failed.push(`${attachment.path} does not exist`);
|
|
584
599
|
}
|
|
585
600
|
}
|
|
@@ -592,12 +607,26 @@ class Message {
|
|
|
592
607
|
failed.push('attachment has no data associated with it');
|
|
593
608
|
}
|
|
594
609
|
});
|
|
595
|
-
|
|
610
|
+
return {
|
|
611
|
+
isValid: failed.length === 0,
|
|
612
|
+
validationError: failed.join(', '),
|
|
613
|
+
};
|
|
596
614
|
}
|
|
615
|
+
return { isValid: true, validationError: undefined };
|
|
597
616
|
}
|
|
598
617
|
/**
|
|
599
618
|
* @public
|
|
600
|
-
* @
|
|
619
|
+
* @deprecated does not conform to the `errback` style followed by the rest of the library, and will be removed in the next major version. use `checkValidity` instead.
|
|
620
|
+
* @param {function(isValid: boolean, invalidReason: (string | undefined)): void} callback .
|
|
621
|
+
* @returns {void}
|
|
622
|
+
*/
|
|
623
|
+
valid(callback) {
|
|
624
|
+
const { isValid, validationError } = this.checkValidity();
|
|
625
|
+
callback(isValid, validationError);
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* @public
|
|
629
|
+
* @returns {MessageStream} a stream of the current message
|
|
601
630
|
*/
|
|
602
631
|
stream() {
|
|
603
632
|
return new MessageStream(this);
|
|
@@ -614,10 +643,22 @@ class Message {
|
|
|
614
643
|
str.on('end', (err) => callback(err, buffer));
|
|
615
644
|
str.on('error', (err) => callback(err, buffer));
|
|
616
645
|
}
|
|
646
|
+
readAsync() {
|
|
647
|
+
return new Promise((resolve, reject) => {
|
|
648
|
+
this.read((err, buffer) => {
|
|
649
|
+
if (err != null) {
|
|
650
|
+
reject(err);
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
resolve(buffer);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
}
|
|
617
658
|
}
|
|
618
659
|
class MessageStream extends stream.Stream {
|
|
619
660
|
/**
|
|
620
|
-
* @param {
|
|
661
|
+
* @param {Message} message the message to stream
|
|
621
662
|
*/
|
|
622
663
|
constructor(message) {
|
|
623
664
|
super();
|
|
@@ -670,7 +711,7 @@ class MessageStream extends stream.Stream {
|
|
|
670
711
|
* @param {MessageAttachment} [attachment] the attachment whose headers you would like to output
|
|
671
712
|
* @returns {void}
|
|
672
713
|
*/
|
|
673
|
-
const
|
|
714
|
+
const outputAttachmentHeaders = (attachment) => {
|
|
674
715
|
let data = [];
|
|
675
716
|
const headers = {
|
|
676
717
|
'content-type': attachment.type +
|
|
@@ -692,74 +733,66 @@ class MessageStream extends stream.Stream {
|
|
|
692
733
|
convertDashDelimitedTextToSnakeCase(header),
|
|
693
734
|
': ',
|
|
694
735
|
headers[header],
|
|
695
|
-
CRLF,
|
|
736
|
+
CRLF$1,
|
|
696
737
|
]);
|
|
697
738
|
}
|
|
698
|
-
output(data.concat([CRLF]).join(''));
|
|
739
|
+
output(data.concat([CRLF$1]).join(''));
|
|
699
740
|
};
|
|
700
741
|
/**
|
|
701
742
|
* @param {string} data the data to output as base64
|
|
702
743
|
* @param {function(): void} [callback] the function to call after output is finished
|
|
703
744
|
* @returns {void}
|
|
704
745
|
*/
|
|
705
|
-
const
|
|
746
|
+
const outputBase64 = (data, callback) => {
|
|
706
747
|
const loops = Math.ceil(data.length / MIMECHUNK);
|
|
707
748
|
let loop = 0;
|
|
708
749
|
while (loop < loops) {
|
|
709
|
-
output(data.substring(MIMECHUNK * loop, MIMECHUNK * (loop + 1)) + CRLF);
|
|
750
|
+
output(data.substring(MIMECHUNK * loop, MIMECHUNK * (loop + 1)) + CRLF$1);
|
|
710
751
|
loop++;
|
|
711
752
|
}
|
|
712
753
|
if (callback) {
|
|
713
754
|
callback();
|
|
714
755
|
}
|
|
715
756
|
};
|
|
716
|
-
const
|
|
757
|
+
const outputFile = (attachment, next) => {
|
|
758
|
+
var _a;
|
|
717
759
|
const chunk = MIME64CHUNK * 16;
|
|
718
760
|
const buffer = Buffer.alloc(chunk);
|
|
719
|
-
const
|
|
761
|
+
const inputEncoding = ((_a = attachment === null || attachment === void 0 ? void 0 : attachment.headers) === null || _a === void 0 ? void 0 : _a['content-transfer-encoding']) || 'base64';
|
|
762
|
+
const encoding = inputEncoding === '7bit'
|
|
763
|
+
? 'ascii'
|
|
764
|
+
: inputEncoding === '8bit'
|
|
765
|
+
? 'binary'
|
|
766
|
+
: inputEncoding;
|
|
720
767
|
/**
|
|
721
768
|
* @param {Error} err the error to emit
|
|
722
769
|
* @param {number} fd the file descriptor
|
|
723
770
|
* @returns {void}
|
|
724
771
|
*/
|
|
725
772
|
const opened = (err, fd) => {
|
|
726
|
-
if (
|
|
727
|
-
const read = (err, bytes) => {
|
|
728
|
-
if (!err && this.readable) {
|
|
729
|
-
let encoding = attachment && attachment.headers
|
|
730
|
-
? attachment.headers['content-transfer-encoding'] || 'base64'
|
|
731
|
-
: 'base64';
|
|
732
|
-
if (encoding === 'ascii' || encoding === '7bit') {
|
|
733
|
-
encoding = 'ascii';
|
|
734
|
-
}
|
|
735
|
-
else if (encoding === 'binary' || encoding === '8bit') {
|
|
736
|
-
encoding = 'binary';
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
encoding = 'base64';
|
|
740
|
-
}
|
|
741
|
-
// guaranteed to be encoded without padding unless it is our last read
|
|
742
|
-
output_base64(buffer.toString(encoding, 0, bytes), () => {
|
|
743
|
-
if (bytes == chunk) {
|
|
744
|
-
// we read a full chunk, there might be more
|
|
745
|
-
fs.read(fd, buffer, 0, chunk, null, read);
|
|
746
|
-
} // that was the last chunk, we are done reading the file
|
|
747
|
-
else {
|
|
748
|
-
this.removeListener('error', closed);
|
|
749
|
-
fs.close(fd, next);
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
else {
|
|
754
|
-
this.emit('error', err || { message: 'message stream was interrupted somehow!' });
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
fs.read(fd, buffer, 0, chunk, null, read);
|
|
758
|
-
this.once('error', closed);
|
|
759
|
-
}
|
|
760
|
-
else {
|
|
773
|
+
if (err) {
|
|
761
774
|
this.emit('error', err);
|
|
775
|
+
return;
|
|
762
776
|
}
|
|
777
|
+
const readBytes = (err, bytes) => {
|
|
778
|
+
if (err || this.readable === false) {
|
|
779
|
+
this.emit('error', err || new Error('message stream was interrupted somehow!'));
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
// guaranteed to be encoded without padding unless it is our last read
|
|
783
|
+
outputBase64(buffer.toString(encoding, 0, bytes), () => {
|
|
784
|
+
if (bytes == chunk) {
|
|
785
|
+
// we read a full chunk, there might be more
|
|
786
|
+
fs.read(fd, buffer, 0, chunk, null, readBytes);
|
|
787
|
+
} // that was the last chunk, we are done reading the file
|
|
788
|
+
else {
|
|
789
|
+
this.removeListener('error', fs.closeSync);
|
|
790
|
+
fs.close(fd, next);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
fs.read(fd, buffer, 0, chunk, null, readBytes);
|
|
795
|
+
this.once('error', fs.closeSync);
|
|
763
796
|
};
|
|
764
797
|
fs.open(attachment.path, 'r', opened);
|
|
765
798
|
};
|
|
@@ -768,13 +801,13 @@ class MessageStream extends stream.Stream {
|
|
|
768
801
|
* @param {function(): void} callback the function to call after output is finished
|
|
769
802
|
* @returns {void}
|
|
770
803
|
*/
|
|
771
|
-
const
|
|
804
|
+
const outputStream = (attachment, callback) => {
|
|
772
805
|
const { stream } = attachment;
|
|
773
806
|
if (stream === null || stream === void 0 ? void 0 : stream.readable) {
|
|
774
807
|
let previous = Buffer.alloc(0);
|
|
775
808
|
stream.resume();
|
|
776
809
|
stream.on('end', () => {
|
|
777
|
-
|
|
810
|
+
outputBase64(previous.toString('base64'), callback);
|
|
778
811
|
this.removeListener('pause', stream.pause);
|
|
779
812
|
this.removeListener('resume', stream.resume);
|
|
780
813
|
this.removeListener('error', stream.resume);
|
|
@@ -792,7 +825,7 @@ class MessageStream extends stream.Stream {
|
|
|
792
825
|
// copy dangling bytes into previous buffer
|
|
793
826
|
buffer.copy(previous, 0, buffer.length - padded);
|
|
794
827
|
}
|
|
795
|
-
|
|
828
|
+
outputBase64(buffer.toString('base64', 0, buffer.length - padded));
|
|
796
829
|
});
|
|
797
830
|
this.on('pause', stream.pause);
|
|
798
831
|
this.on('resume', stream.resume);
|
|
@@ -802,13 +835,13 @@ class MessageStream extends stream.Stream {
|
|
|
802
835
|
this.emit('error', { message: 'stream not readable' });
|
|
803
836
|
}
|
|
804
837
|
};
|
|
805
|
-
const
|
|
838
|
+
const outputAttachment = (attachment, callback) => {
|
|
806
839
|
const build = attachment.path
|
|
807
|
-
?
|
|
840
|
+
? outputFile
|
|
808
841
|
: attachment.stream
|
|
809
|
-
?
|
|
810
|
-
:
|
|
811
|
-
|
|
842
|
+
? outputStream
|
|
843
|
+
: outputData;
|
|
844
|
+
outputAttachmentHeaders(attachment);
|
|
812
845
|
build(attachment, callback);
|
|
813
846
|
};
|
|
814
847
|
/**
|
|
@@ -818,32 +851,32 @@ class MessageStream extends stream.Stream {
|
|
|
818
851
|
* @param {function(): void} callback the function to call if index is greater than upper bound
|
|
819
852
|
* @returns {void}
|
|
820
853
|
*/
|
|
821
|
-
const
|
|
854
|
+
const outputMessage = (boundary, list, index, callback) => {
|
|
822
855
|
if (index < list.length) {
|
|
823
|
-
output(`--${boundary}${CRLF}`);
|
|
856
|
+
output(`--${boundary}${CRLF$1}`);
|
|
824
857
|
if (list[index].related) {
|
|
825
|
-
|
|
858
|
+
outputRelated(list[index], () => outputMessage(boundary, list, index + 1, callback));
|
|
826
859
|
}
|
|
827
860
|
else {
|
|
828
|
-
|
|
861
|
+
outputAttachment(list[index], () => outputMessage(boundary, list, index + 1, callback));
|
|
829
862
|
}
|
|
830
863
|
}
|
|
831
864
|
else {
|
|
832
|
-
output(`${CRLF}--${boundary}--${CRLF}${CRLF}`);
|
|
865
|
+
output(`${CRLF$1}--${boundary}--${CRLF$1}${CRLF$1}`);
|
|
833
866
|
callback();
|
|
834
867
|
}
|
|
835
868
|
};
|
|
836
|
-
const
|
|
837
|
-
const boundary =
|
|
838
|
-
output(`Content-Type: multipart/mixed; boundary="${boundary}"${CRLF}${CRLF}--${boundary}${CRLF}`);
|
|
869
|
+
const outputMixed = () => {
|
|
870
|
+
const boundary = generateBoundary();
|
|
871
|
+
output(`Content-Type: multipart/mixed; boundary="${boundary}"${CRLF$1}${CRLF$1}--${boundary}${CRLF$1}`);
|
|
839
872
|
if (this.message.alternative == null) {
|
|
840
|
-
|
|
841
|
-
|
|
873
|
+
outputText(this.message);
|
|
874
|
+
outputMessage(boundary, this.message.attachments, 0, close);
|
|
842
875
|
}
|
|
843
876
|
else {
|
|
844
|
-
|
|
877
|
+
outputAlternative(
|
|
845
878
|
// typescript bug; should narrow to { alternative: MessageAttachment }
|
|
846
|
-
this.message, () =>
|
|
879
|
+
this.message, () => outputMessage(boundary, this.message.attachments, 0, close));
|
|
847
880
|
}
|
|
848
881
|
};
|
|
849
882
|
/**
|
|
@@ -851,26 +884,27 @@ class MessageStream extends stream.Stream {
|
|
|
851
884
|
* @param {function(): void} callback the function to call after output is finished
|
|
852
885
|
* @returns {void}
|
|
853
886
|
*/
|
|
854
|
-
const
|
|
887
|
+
const outputData = (attachment, callback) => {
|
|
855
888
|
var _a, _b;
|
|
856
|
-
|
|
857
|
-
? (_a = attachment.data) !== null && _a !== void 0 ? _a : ''
|
|
889
|
+
outputBase64(attachment.encoded
|
|
890
|
+
? (_a = attachment.data) !== null && _a !== void 0 ? _a : ''
|
|
891
|
+
: Buffer.from((_b = attachment.data) !== null && _b !== void 0 ? _b : '').toString('base64'), callback);
|
|
858
892
|
};
|
|
859
893
|
/**
|
|
860
894
|
* @param {Message} message the message to output
|
|
861
895
|
* @returns {void}
|
|
862
896
|
*/
|
|
863
|
-
const
|
|
897
|
+
const outputText = (message) => {
|
|
864
898
|
let data = [];
|
|
865
899
|
data = data.concat([
|
|
866
900
|
'Content-Type:',
|
|
867
901
|
message.content,
|
|
868
|
-
CRLF,
|
|
902
|
+
CRLF$1,
|
|
869
903
|
'Content-Transfer-Encoding: 7bit',
|
|
870
|
-
CRLF,
|
|
904
|
+
CRLF$1,
|
|
871
905
|
]);
|
|
872
|
-
data = data.concat(['Content-Disposition: inline', CRLF, CRLF]);
|
|
873
|
-
data = data.concat([message.text || '', CRLF, CRLF]);
|
|
906
|
+
data = data.concat(['Content-Disposition: inline', CRLF$1, CRLF$1]);
|
|
907
|
+
data = data.concat([message.text || '', CRLF$1, CRLF$1]);
|
|
874
908
|
output(data.join(''));
|
|
875
909
|
};
|
|
876
910
|
/**
|
|
@@ -878,13 +912,13 @@ class MessageStream extends stream.Stream {
|
|
|
878
912
|
* @param {function(): void} callback the function to call after output is finished
|
|
879
913
|
* @returns {void}
|
|
880
914
|
*/
|
|
881
|
-
const
|
|
882
|
-
const boundary =
|
|
883
|
-
output(`Content-Type: multipart/related; boundary="${boundary}"${CRLF}${CRLF}--${boundary}${CRLF}`);
|
|
884
|
-
|
|
915
|
+
const outputRelated = (message, callback) => {
|
|
916
|
+
const boundary = generateBoundary();
|
|
917
|
+
output(`Content-Type: multipart/related; boundary="${boundary}"${CRLF$1}${CRLF$1}--${boundary}${CRLF$1}`);
|
|
918
|
+
outputAttachment(message, () => {
|
|
885
919
|
var _a;
|
|
886
|
-
|
|
887
|
-
output(`${CRLF}--${boundary}--${CRLF}${CRLF}`);
|
|
920
|
+
outputMessage(boundary, (_a = message.related) !== null && _a !== void 0 ? _a : [], 0, () => {
|
|
921
|
+
output(`${CRLF$1}--${boundary}--${CRLF$1}${CRLF$1}`);
|
|
888
922
|
callback();
|
|
889
923
|
});
|
|
890
924
|
});
|
|
@@ -894,23 +928,23 @@ class MessageStream extends stream.Stream {
|
|
|
894
928
|
* @param {function(): void} callback the function to call after output is finished
|
|
895
929
|
* @returns {void}
|
|
896
930
|
*/
|
|
897
|
-
const
|
|
898
|
-
const boundary =
|
|
899
|
-
output(`Content-Type: multipart/alternative; boundary="${boundary}"${CRLF}${CRLF}--${boundary}${CRLF}`);
|
|
900
|
-
|
|
901
|
-
output(`--${boundary}${CRLF}`);
|
|
931
|
+
const outputAlternative = (message, callback) => {
|
|
932
|
+
const boundary = generateBoundary();
|
|
933
|
+
output(`Content-Type: multipart/alternative; boundary="${boundary}"${CRLF$1}${CRLF$1}--${boundary}${CRLF$1}`);
|
|
934
|
+
outputText(message);
|
|
935
|
+
output(`--${boundary}${CRLF$1}`);
|
|
902
936
|
/**
|
|
903
937
|
* @returns {void}
|
|
904
938
|
*/
|
|
905
939
|
const finish = () => {
|
|
906
|
-
output([CRLF, '--', boundary, '--', CRLF, CRLF].join(''));
|
|
940
|
+
output([CRLF$1, '--', boundary, '--', CRLF$1, CRLF$1].join(''));
|
|
907
941
|
callback();
|
|
908
942
|
};
|
|
909
943
|
if (message.alternative.related) {
|
|
910
|
-
|
|
944
|
+
outputRelated(message.alternative, finish);
|
|
911
945
|
}
|
|
912
946
|
else {
|
|
913
|
-
|
|
947
|
+
outputAttachment(message.alternative, finish);
|
|
914
948
|
}
|
|
915
949
|
};
|
|
916
950
|
const close = (err) => {
|
|
@@ -934,20 +968,20 @@ class MessageStream extends stream.Stream {
|
|
|
934
968
|
/**
|
|
935
969
|
* @returns {void}
|
|
936
970
|
*/
|
|
937
|
-
const
|
|
971
|
+
const outputHeaderData = () => {
|
|
938
972
|
if (this.message.attachments.length || this.message.alternative) {
|
|
939
|
-
output(`MIME-Version: 1.0${CRLF}`);
|
|
940
|
-
|
|
973
|
+
output(`MIME-Version: 1.0${CRLF$1}`);
|
|
974
|
+
outputMixed();
|
|
941
975
|
} // you only have a text message!
|
|
942
976
|
else {
|
|
943
|
-
|
|
977
|
+
outputText(this.message);
|
|
944
978
|
close();
|
|
945
979
|
}
|
|
946
980
|
};
|
|
947
981
|
/**
|
|
948
982
|
* @returns {void}
|
|
949
983
|
*/
|
|
950
|
-
const
|
|
984
|
+
const outputHeader = () => {
|
|
951
985
|
let data = [];
|
|
952
986
|
for (const header in this.message.header) {
|
|
953
987
|
// do not output BCC in the headers (regex) nor custom Object.prototype functions...
|
|
@@ -957,15 +991,15 @@ class MessageStream extends stream.Stream {
|
|
|
957
991
|
convertDashDelimitedTextToSnakeCase(header),
|
|
958
992
|
': ',
|
|
959
993
|
this.message.header[header],
|
|
960
|
-
CRLF,
|
|
994
|
+
CRLF$1,
|
|
961
995
|
]);
|
|
962
996
|
}
|
|
963
997
|
}
|
|
964
998
|
output(data.join(''));
|
|
965
|
-
|
|
999
|
+
outputHeaderData();
|
|
966
1000
|
};
|
|
967
1001
|
this.once('destroy', close);
|
|
968
|
-
process.nextTick(
|
|
1002
|
+
process.nextTick(outputHeader);
|
|
969
1003
|
}
|
|
970
1004
|
/**
|
|
971
1005
|
* @public
|
|
@@ -1132,11 +1166,11 @@ const DEFAULT_TIMEOUT = 5000;
|
|
|
1132
1166
|
const SMTP_PORT = 25;
|
|
1133
1167
|
const SMTP_SSL_PORT = 465;
|
|
1134
1168
|
const SMTP_TLS_PORT = 587;
|
|
1135
|
-
const CRLF
|
|
1169
|
+
const CRLF = '\r\n';
|
|
1136
1170
|
const GREYLIST_DELAY = 300;
|
|
1137
1171
|
let DEBUG = 0;
|
|
1138
1172
|
/**
|
|
1139
|
-
* @param {...any} args the message(s) to log
|
|
1173
|
+
* @param {...any[]} args the message(s) to log
|
|
1140
1174
|
* @returns {void}
|
|
1141
1175
|
*/
|
|
1142
1176
|
const log = (...args) => {
|
|
@@ -1149,8 +1183,8 @@ const log = (...args) => {
|
|
|
1149
1183
|
}
|
|
1150
1184
|
};
|
|
1151
1185
|
/**
|
|
1152
|
-
* @param {function(
|
|
1153
|
-
* @param {
|
|
1186
|
+
* @param {function(...any[]): void} callback the function to call
|
|
1187
|
+
* @param {...any[]} args the arguments to apply to the function
|
|
1154
1188
|
* @returns {void}
|
|
1155
1189
|
*/
|
|
1156
1190
|
const caller = (callback, ...args) => {
|
|
@@ -1187,7 +1221,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1187
1221
|
this.host = 'localhost';
|
|
1188
1222
|
this.ssl = false;
|
|
1189
1223
|
this.tls = false;
|
|
1190
|
-
this.greylistResponseTracker = new
|
|
1224
|
+
this.greylistResponseTracker = new WeakSet();
|
|
1191
1225
|
if (Array.isArray(authentication)) {
|
|
1192
1226
|
this.authentication = authentication;
|
|
1193
1227
|
}
|
|
@@ -1250,7 +1284,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1250
1284
|
* NOTE: `host` is trimmed before being used to establish a connection; however, the original untrimmed value will still be visible in configuration.
|
|
1251
1285
|
*
|
|
1252
1286
|
* @public
|
|
1253
|
-
* @param {function(
|
|
1287
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1254
1288
|
* @param {number} [port] the port to use for the connection
|
|
1255
1289
|
* @param {string} [host] the hostname to use for the connection
|
|
1256
1290
|
* @param {ConnectOptions} [options={}] the options
|
|
@@ -1332,7 +1366,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1332
1366
|
/**
|
|
1333
1367
|
* @public
|
|
1334
1368
|
* @param {string} str the string to send
|
|
1335
|
-
* @param {
|
|
1369
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1336
1370
|
* @returns {void}
|
|
1337
1371
|
*/
|
|
1338
1372
|
send(str, callback) {
|
|
@@ -1359,7 +1393,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1359
1393
|
/**
|
|
1360
1394
|
* @public
|
|
1361
1395
|
* @param {string} cmd command to issue
|
|
1362
|
-
* @param {function(
|
|
1396
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1363
1397
|
* @param {(number[] | number)} [codes=[250]] array codes
|
|
1364
1398
|
* @returns {void}
|
|
1365
1399
|
*/
|
|
@@ -1380,10 +1414,10 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1380
1414
|
}
|
|
1381
1415
|
else if ((code === 450 || code === 451) &&
|
|
1382
1416
|
msg.message.toLowerCase().includes('greylist') &&
|
|
1383
|
-
this.greylistResponseTracker.
|
|
1384
|
-
this.greylistResponseTracker.
|
|
1417
|
+
this.greylistResponseTracker.has(response) === false) {
|
|
1418
|
+
this.greylistResponseTracker.add(response);
|
|
1385
1419
|
setTimeout(() => {
|
|
1386
|
-
this.send(cmd + CRLF
|
|
1420
|
+
this.send(cmd + CRLF, response);
|
|
1387
1421
|
}, GREYLIST_DELAY);
|
|
1388
1422
|
}
|
|
1389
1423
|
else {
|
|
@@ -1393,8 +1427,8 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1393
1427
|
}
|
|
1394
1428
|
}
|
|
1395
1429
|
};
|
|
1396
|
-
this.greylistResponseTracker.
|
|
1397
|
-
this.send(cmd + CRLF
|
|
1430
|
+
this.greylistResponseTracker.delete(response);
|
|
1431
|
+
this.send(cmd + CRLF, response);
|
|
1398
1432
|
}
|
|
1399
1433
|
/**
|
|
1400
1434
|
* @public
|
|
@@ -1406,7 +1440,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1406
1440
|
* As this command was deprecated by rfc2821, it should only be used for compatibility with non-compliant servers.
|
|
1407
1441
|
* @see https://tools.ietf.org/html/rfc2821#appendix-F.3
|
|
1408
1442
|
*
|
|
1409
|
-
* @param {function(
|
|
1443
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1410
1444
|
* @param {string} domain the domain to associate with the 'helo' request
|
|
1411
1445
|
* @returns {void}
|
|
1412
1446
|
*/
|
|
@@ -1423,7 +1457,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1423
1457
|
}
|
|
1424
1458
|
/**
|
|
1425
1459
|
* @public
|
|
1426
|
-
* @param {function(
|
|
1460
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1427
1461
|
* @returns {void}
|
|
1428
1462
|
*/
|
|
1429
1463
|
starttls(callback) {
|
|
@@ -1478,7 +1512,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1478
1512
|
}
|
|
1479
1513
|
/**
|
|
1480
1514
|
* @public
|
|
1481
|
-
* @param {function(
|
|
1515
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1482
1516
|
* @param {string} domain the domain to associate with the 'ehlo' request
|
|
1483
1517
|
* @returns {void}
|
|
1484
1518
|
*/
|
|
@@ -1511,7 +1545,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1511
1545
|
/**
|
|
1512
1546
|
* @public
|
|
1513
1547
|
* @description SMTP 'help' command, returns text from the server
|
|
1514
|
-
* @param {function(
|
|
1548
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1515
1549
|
* @param {string} domain the domain to associate with the 'help' request
|
|
1516
1550
|
* @returns {void}
|
|
1517
1551
|
*/
|
|
@@ -1520,7 +1554,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1520
1554
|
}
|
|
1521
1555
|
/**
|
|
1522
1556
|
* @public
|
|
1523
|
-
* @param {function(
|
|
1557
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1524
1558
|
* @returns {void}
|
|
1525
1559
|
*/
|
|
1526
1560
|
rset(callback) {
|
|
@@ -1528,7 +1562,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1528
1562
|
}
|
|
1529
1563
|
/**
|
|
1530
1564
|
* @public
|
|
1531
|
-
* @param {function(
|
|
1565
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1532
1566
|
* @returns {void}
|
|
1533
1567
|
*/
|
|
1534
1568
|
noop(callback) {
|
|
@@ -1536,7 +1570,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1536
1570
|
}
|
|
1537
1571
|
/**
|
|
1538
1572
|
* @public
|
|
1539
|
-
* @param {function(
|
|
1573
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1540
1574
|
* @param {string} from the sender
|
|
1541
1575
|
* @returns {void}
|
|
1542
1576
|
*/
|
|
@@ -1545,7 +1579,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1545
1579
|
}
|
|
1546
1580
|
/**
|
|
1547
1581
|
* @public
|
|
1548
|
-
* @param {function(
|
|
1582
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1549
1583
|
* @param {string} to the receiver
|
|
1550
1584
|
* @returns {void}
|
|
1551
1585
|
*/
|
|
@@ -1554,7 +1588,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1554
1588
|
}
|
|
1555
1589
|
/**
|
|
1556
1590
|
* @public
|
|
1557
|
-
* @param {function(
|
|
1591
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1558
1592
|
* @returns {void}
|
|
1559
1593
|
*/
|
|
1560
1594
|
data(callback) {
|
|
@@ -1562,11 +1596,11 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1562
1596
|
}
|
|
1563
1597
|
/**
|
|
1564
1598
|
* @public
|
|
1565
|
-
* @param {function(
|
|
1599
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1566
1600
|
* @returns {void}
|
|
1567
1601
|
*/
|
|
1568
1602
|
data_end(callback) {
|
|
1569
|
-
this.command(`${CRLF
|
|
1603
|
+
this.command(`${CRLF}.`, callback);
|
|
1570
1604
|
}
|
|
1571
1605
|
/**
|
|
1572
1606
|
* @public
|
|
@@ -1582,7 +1616,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1582
1616
|
* @public
|
|
1583
1617
|
* @description SMTP 'verify' command -- checks for address validity.
|
|
1584
1618
|
* @param {string} address the address to validate
|
|
1585
|
-
* @param {function(
|
|
1619
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1586
1620
|
* @returns {void}
|
|
1587
1621
|
*/
|
|
1588
1622
|
verify(address, callback) {
|
|
@@ -1592,7 +1626,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1592
1626
|
* @public
|
|
1593
1627
|
* @description SMTP 'expn' command -- expands a mailing list.
|
|
1594
1628
|
* @param {string} address the mailing list to expand
|
|
1595
|
-
* @param {function(
|
|
1629
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1596
1630
|
* @returns {void}
|
|
1597
1631
|
*/
|
|
1598
1632
|
expn(address, callback) {
|
|
@@ -1605,7 +1639,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1605
1639
|
* If there has been no previous EHLO or HELO command self session, self
|
|
1606
1640
|
* method tries ESMTP EHLO first.
|
|
1607
1641
|
*
|
|
1608
|
-
* @param {function(
|
|
1642
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1609
1643
|
* @param {string} [domain] the domain to associate with the command
|
|
1610
1644
|
* @returns {void}
|
|
1611
1645
|
*/
|
|
@@ -1633,7 +1667,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1633
1667
|
*
|
|
1634
1668
|
* This method will return normally if the authentication was successful.
|
|
1635
1669
|
*
|
|
1636
|
-
* @param {function(
|
|
1670
|
+
* @param {function(...any[]): void} callback function to call after response
|
|
1637
1671
|
* @param {string} [user] the username to authenticate with
|
|
1638
1672
|
* @param {string} [password] the password for the authentication
|
|
1639
1673
|
* @param {{ method: string, domain: string }} [options] login options
|
|
@@ -1658,7 +1692,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1658
1692
|
* @param {string} challenge challenge
|
|
1659
1693
|
* @returns {string} base64 cram hash
|
|
1660
1694
|
*/
|
|
1661
|
-
const
|
|
1695
|
+
const encodeCramMd5 = (challenge) => {
|
|
1662
1696
|
const hmac = crypto.createHmac('md5', login.password());
|
|
1663
1697
|
hmac.update(Buffer.from(challenge, 'base64').toString('ascii'));
|
|
1664
1698
|
return Buffer.from(`${login.user()} ${hmac.digest('hex')}`).toString('base64');
|
|
@@ -1666,19 +1700,19 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1666
1700
|
/**
|
|
1667
1701
|
* @returns {string} base64 login/password
|
|
1668
1702
|
*/
|
|
1669
|
-
const
|
|
1703
|
+
const encodePlain = () => Buffer.from(`\u0000${login.user()}\u0000${login.password()}`).toString('base64');
|
|
1670
1704
|
/**
|
|
1671
1705
|
* @see https://developers.google.com/gmail/xoauth2_protocol
|
|
1672
1706
|
* @returns {string} base64 xoauth2 auth token
|
|
1673
1707
|
*/
|
|
1674
|
-
const
|
|
1708
|
+
const encodeXoauth2 = () => Buffer.from(`user=${login.user()}\u0001auth=Bearer ${login.password()}\u0001\u0001`).toString('base64');
|
|
1675
1709
|
// List of authentication methods we support: from preferred to
|
|
1676
1710
|
// less preferred methods.
|
|
1677
1711
|
if (!method) {
|
|
1678
1712
|
const preferred = this.authentication;
|
|
1679
1713
|
let auth = '';
|
|
1680
|
-
if (typeof ((_a = this.features) === null || _a === void 0 ? void 0 : _a
|
|
1681
|
-
auth = this.features
|
|
1714
|
+
if (typeof ((_a = this.features) === null || _a === void 0 ? void 0 : _a['auth']) === 'string') {
|
|
1715
|
+
auth = this.features['auth'];
|
|
1682
1716
|
}
|
|
1683
1717
|
for (let i = 0; i < preferred.length; i++) {
|
|
1684
1718
|
if (auth.includes(preferred[i])) {
|
|
@@ -1690,7 +1724,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1690
1724
|
/**
|
|
1691
1725
|
* handle bad responses from command differently
|
|
1692
1726
|
* @param {Error} err err
|
|
1693
|
-
* @param {
|
|
1727
|
+
* @param {unknown} data data
|
|
1694
1728
|
* @returns {void}
|
|
1695
1729
|
*/
|
|
1696
1730
|
const failed = (err, data) => {
|
|
@@ -1700,7 +1734,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1700
1734
|
};
|
|
1701
1735
|
/**
|
|
1702
1736
|
* @param {Error} err err
|
|
1703
|
-
* @param {
|
|
1737
|
+
* @param {unknown} data data
|
|
1704
1738
|
* @returns {void}
|
|
1705
1739
|
*/
|
|
1706
1740
|
const response = (err, data) => {
|
|
@@ -1714,7 +1748,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1714
1748
|
};
|
|
1715
1749
|
/**
|
|
1716
1750
|
* @param {Error} err err
|
|
1717
|
-
* @param {
|
|
1751
|
+
* @param {unknown} data data
|
|
1718
1752
|
* @param {string} msg msg
|
|
1719
1753
|
* @returns {void}
|
|
1720
1754
|
*/
|
|
@@ -1724,7 +1758,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1724
1758
|
}
|
|
1725
1759
|
else {
|
|
1726
1760
|
if (method === AUTH_METHODS['CRAM-MD5']) {
|
|
1727
|
-
this.command(
|
|
1761
|
+
this.command(encodeCramMd5(msg), response, [235, 503]);
|
|
1728
1762
|
}
|
|
1729
1763
|
else if (method === AUTH_METHODS.LOGIN) {
|
|
1730
1764
|
this.command(Buffer.from(login.password()).toString('base64'), response, [235, 503]);
|
|
@@ -1733,11 +1767,11 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1733
1767
|
};
|
|
1734
1768
|
/**
|
|
1735
1769
|
* @param {Error} err err
|
|
1736
|
-
* @param {
|
|
1770
|
+
* @param {unknown} data data
|
|
1737
1771
|
* @param {string} msg msg
|
|
1738
1772
|
* @returns {void}
|
|
1739
1773
|
*/
|
|
1740
|
-
const
|
|
1774
|
+
const attemptUser = (err, data) => {
|
|
1741
1775
|
if (err) {
|
|
1742
1776
|
failed(err, data);
|
|
1743
1777
|
}
|
|
@@ -1752,18 +1786,16 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1752
1786
|
this.command(`AUTH ${AUTH_METHODS['CRAM-MD5']}`, attempt, [334]);
|
|
1753
1787
|
break;
|
|
1754
1788
|
case AUTH_METHODS.LOGIN:
|
|
1755
|
-
this.command(`AUTH ${AUTH_METHODS.LOGIN}`,
|
|
1789
|
+
this.command(`AUTH ${AUTH_METHODS.LOGIN}`, attemptUser, [334]);
|
|
1756
1790
|
break;
|
|
1757
1791
|
case AUTH_METHODS.PLAIN:
|
|
1758
|
-
this.command(`AUTH ${AUTH_METHODS.PLAIN} ${
|
|
1792
|
+
this.command(`AUTH ${AUTH_METHODS.PLAIN} ${encodePlain()}`, response, [235, 503]);
|
|
1759
1793
|
break;
|
|
1760
1794
|
case AUTH_METHODS.XOAUTH2:
|
|
1761
|
-
this.command(`AUTH ${AUTH_METHODS.XOAUTH2} ${
|
|
1795
|
+
this.command(`AUTH ${AUTH_METHODS.XOAUTH2} ${encodeXoauth2()}`, response, [235, 503]);
|
|
1762
1796
|
break;
|
|
1763
1797
|
default:
|
|
1764
|
-
|
|
1765
|
-
const err = SMTPError.create(msg, SMTPErrorStates.AUTHNOTSUPPORTED, null, data);
|
|
1766
|
-
caller(callback, err);
|
|
1798
|
+
caller(callback, SMTPError.create('no form of authorization supported', SMTPErrorStates.AUTHNOTSUPPORTED, null, data));
|
|
1767
1799
|
break;
|
|
1768
1800
|
}
|
|
1769
1801
|
};
|
|
@@ -1797,7 +1829,7 @@ class SMTPConnection extends events.EventEmitter {
|
|
|
1797
1829
|
}
|
|
1798
1830
|
/**
|
|
1799
1831
|
* @public
|
|
1800
|
-
* @param {function(
|
|
1832
|
+
* @param {function(...any[]): void} [callback] function to call after response
|
|
1801
1833
|
* @returns {void}
|
|
1802
1834
|
*/
|
|
1803
1835
|
quit(callback) {
|
|
@@ -1839,18 +1871,34 @@ class SMTPClient {
|
|
|
1839
1871
|
callback(new Error('message is not a valid Message instance'), msg);
|
|
1840
1872
|
return;
|
|
1841
1873
|
}
|
|
1842
|
-
message.
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1874
|
+
const { isValid, validationError } = message.checkValidity();
|
|
1875
|
+
if (isValid) {
|
|
1876
|
+
const stack = this.createMessageStack(message, callback);
|
|
1877
|
+
if (stack.to.length === 0) {
|
|
1878
|
+
return callback(new Error('No recipients found in message'), msg);
|
|
1879
|
+
}
|
|
1880
|
+
this.queue.push(stack);
|
|
1881
|
+
this._poll();
|
|
1882
|
+
}
|
|
1883
|
+
else {
|
|
1884
|
+
callback(new Error(validationError), msg);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* @public
|
|
1889
|
+
* @param {Message} msg the message to send
|
|
1890
|
+
* @returns {Promise<Message>} a promise that resolves to the fully processed message
|
|
1891
|
+
*/
|
|
1892
|
+
sendAsync(msg) {
|
|
1893
|
+
return new Promise((resolve, reject) => {
|
|
1894
|
+
this.send(msg, (err, msg) => {
|
|
1895
|
+
if (err != null) {
|
|
1896
|
+
reject(err);
|
|
1847
1897
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
callback(new Error(why), msg);
|
|
1853
|
-
}
|
|
1898
|
+
else {
|
|
1899
|
+
resolve(msg);
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1854
1902
|
});
|
|
1855
1903
|
}
|
|
1856
1904
|
/**
|
|
@@ -1966,8 +2014,8 @@ class SMTPClient {
|
|
|
1966
2014
|
}
|
|
1967
2015
|
/**
|
|
1968
2016
|
* @protected
|
|
1969
|
-
* @param {
|
|
1970
|
-
* @returns {
|
|
2017
|
+
* @param {MessageAttachment | MessageAttachment[]} attachment attachment
|
|
2018
|
+
* @returns {boolean} whether the attachment contains inlined html
|
|
1971
2019
|
*/
|
|
1972
2020
|
_containsInlinedHtml(attachment) {
|
|
1973
2021
|
if (Array.isArray(attachment)) {
|
|
@@ -2088,6 +2136,7 @@ exports.SMTPState = SMTPState;
|
|
|
2088
2136
|
exports.addressparser = addressparser;
|
|
2089
2137
|
exports.getRFC2822Date = getRFC2822Date;
|
|
2090
2138
|
exports.getRFC2822DateUTC = getRFC2822DateUTC;
|
|
2139
|
+
exports.isRFC2822Date = isRFC2822Date;
|
|
2091
2140
|
exports.mimeEncode = mimeEncode;
|
|
2092
2141
|
exports.mimeWordEncode = mimeWordEncode;
|
|
2093
2142
|
//# sourceMappingURL=email.cjs.map
|