emailjs 1.0.11 → 2.2.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/.editorconfig +10 -0
- package/.eslintrc.json +40 -0
- package/CHANGELOG.md +9 -0
- package/email.js +2 -0
- package/package.json +21 -16
- package/smtp/client.js +323 -206
- package/smtp/date.js +38 -0
- package/smtp/error.js +73 -7
- package/smtp/message.js +728 -619
- package/smtp/response.js +126 -68
- package/smtp/smtp.js +852 -569
- package/yarn.lock +1105 -0
package/.editorconfig
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es6": true,
|
|
4
|
+
"mocha": true,
|
|
5
|
+
"node": true
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
"mocha"
|
|
9
|
+
],
|
|
10
|
+
"extends": [
|
|
11
|
+
"eslint:recommended",
|
|
12
|
+
"plugin:prettier/recommended"
|
|
13
|
+
],
|
|
14
|
+
"rules": {
|
|
15
|
+
"curly": [
|
|
16
|
+
"error",
|
|
17
|
+
"all"
|
|
18
|
+
],
|
|
19
|
+
"linebreak-style": [
|
|
20
|
+
"error",
|
|
21
|
+
"unix"
|
|
22
|
+
],
|
|
23
|
+
"no-case-declarations": "off",
|
|
24
|
+
"no-console": "off",
|
|
25
|
+
"no-unused-vars": [
|
|
26
|
+
"error",
|
|
27
|
+
{
|
|
28
|
+
"vars": "all",
|
|
29
|
+
"args": "none",
|
|
30
|
+
"ignoreRestSiblings": true
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"valid-jsdoc": "error",
|
|
34
|
+
"mocha/handle-done-callback": "error",
|
|
35
|
+
"mocha/no-exclusive-tests": "error",
|
|
36
|
+
"mocha/no-global-tests": "error",
|
|
37
|
+
"mocha/no-mocha-arrows": "error",
|
|
38
|
+
"mocha/no-skipped-tests": "error"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [2.0.1] - 2018-02-11
|
|
8
|
+
### Added
|
|
9
|
+
- a new changelog
|
package/email.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emailjs",
|
|
3
3
|
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"author": "eleith",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"izuzak",
|
|
8
8
|
"Hiverness",
|
|
9
9
|
"mscdex",
|
|
10
|
-
"jimmybergman"
|
|
10
|
+
"jimmybergman",
|
|
11
|
+
"zackschuster"
|
|
11
12
|
],
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -15,26 +16,30 @@
|
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"addressparser": "^0.3.2",
|
|
18
|
-
"
|
|
19
|
-
"moment": "2.11.2",
|
|
20
|
-
"starttls": "1.0.1"
|
|
21
|
-
},
|
|
22
|
-
"optionalDependencies": {
|
|
23
|
-
"bufferjs": "1.1.0"
|
|
19
|
+
"emailjs-mime-codec": "^2.0.7"
|
|
24
20
|
},
|
|
25
21
|
"devDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
22
|
+
"chai": "^4.1.2",
|
|
23
|
+
"eslint": "^4.19.1",
|
|
24
|
+
"eslint-config-prettier": "^2.9.0",
|
|
25
|
+
"eslint-plugin-mocha": "^5.0.0",
|
|
26
|
+
"eslint-plugin-prettier": "^2.6.0",
|
|
27
|
+
"mailparser": "^2.2.0",
|
|
28
|
+
"mocha": "^5.2.0",
|
|
29
|
+
"prettier": "^1.13.5",
|
|
30
|
+
"smtp-server": "^3.4.6"
|
|
31
31
|
},
|
|
32
32
|
"engine": [
|
|
33
|
-
"node >=
|
|
33
|
+
"node >= 6"
|
|
34
34
|
],
|
|
35
35
|
"main": "email.js",
|
|
36
36
|
"scripts": {
|
|
37
|
-
"test": "mocha -R spec
|
|
37
|
+
"test": "mocha -R spec"
|
|
38
38
|
},
|
|
39
|
-
"license"
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"prettier": {
|
|
41
|
+
"singleQuote": true,
|
|
42
|
+
"trailingComma": "es5",
|
|
43
|
+
"useTabs": true
|
|
44
|
+
}
|
|
40
45
|
}
|
package/smtp/client.js
CHANGED
|
@@ -1,209 +1,326 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
1
|
+
const { SMTP, state } = require('./smtp');
|
|
2
|
+
const { Message, create } = require('./message');
|
|
3
|
+
const addressparser = require('addressparser');
|
|
4
|
+
|
|
5
|
+
class Client {
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} SMTPOptions
|
|
8
|
+
* @property {number} [timeout]
|
|
9
|
+
* @property {string} [user]
|
|
10
|
+
* @property {string} [password]
|
|
11
|
+
* @property {string} [domain]
|
|
12
|
+
* @property {string} [host]
|
|
13
|
+
* @property {number} [port]
|
|
14
|
+
* @property {boolean} [ssl]
|
|
15
|
+
* @property {boolean} [tls]
|
|
16
|
+
* @property {string[]} [authentication]
|
|
17
|
+
*
|
|
18
|
+
* @typedef {Object} MessageStack
|
|
19
|
+
* @property {function(Error, Message): void} [callback]
|
|
20
|
+
* @property {Message} [message]
|
|
21
|
+
* @property {string} [returnPath]
|
|
22
|
+
* @property {string} [from]
|
|
23
|
+
* @property {string} [subject]
|
|
24
|
+
* @property {string|Array} [to]
|
|
25
|
+
* @property {Array} [cc]
|
|
26
|
+
* @property {Array} [bcc]
|
|
27
|
+
* @property {string} [text]
|
|
28
|
+
* @property {*} [attachment]
|
|
29
|
+
*
|
|
30
|
+
* @constructor
|
|
31
|
+
* @param {SMTPOptions} server smtp options
|
|
32
|
+
*/
|
|
33
|
+
constructor(server) {
|
|
34
|
+
this.smtp = new SMTP(server);
|
|
35
|
+
//this.smtp.debug(1);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @type {MessageStack[]}
|
|
39
|
+
*/
|
|
40
|
+
this.queue = [];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @type {NodeJS.Timer}
|
|
44
|
+
*/
|
|
45
|
+
this.timer = null;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
*/
|
|
50
|
+
this.sending = false;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @type {boolean}
|
|
54
|
+
*/
|
|
55
|
+
this.ready = false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {Message|MessageStack} msg msg
|
|
60
|
+
* @param {function(Error, MessageStack): void} callback callback
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
send(msg, callback) {
|
|
64
|
+
/**
|
|
65
|
+
* @type {Message}
|
|
66
|
+
*/
|
|
67
|
+
const message =
|
|
68
|
+
msg instanceof Message
|
|
69
|
+
? msg
|
|
70
|
+
: this._canMakeMessage(msg)
|
|
71
|
+
? create(msg)
|
|
72
|
+
: null;
|
|
73
|
+
|
|
74
|
+
if (message == null) {
|
|
75
|
+
callback(
|
|
76
|
+
new Error('message is not a valid Message instance'),
|
|
77
|
+
/** @type {MessageStack} */ (msg)
|
|
78
|
+
);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message.valid((valid, why) => {
|
|
83
|
+
if (valid) {
|
|
84
|
+
const stack = {
|
|
85
|
+
message,
|
|
86
|
+
to: addressparser(message.header.to),
|
|
87
|
+
from: addressparser(message.header.from)[0].address,
|
|
88
|
+
callback: (callback || function() {}).bind(this),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
if (message.header.cc) {
|
|
92
|
+
stack.to = stack.to.concat(addressparser(message.header.cc));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (message.header.bcc) {
|
|
96
|
+
stack.to = stack.to.concat(addressparser(message.header.bcc));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (
|
|
100
|
+
message.header['return-path'] &&
|
|
101
|
+
addressparser(message.header['return-path']).length
|
|
102
|
+
) {
|
|
103
|
+
stack.returnPath = addressparser(
|
|
104
|
+
message.header['return-path']
|
|
105
|
+
)[0].address;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.queue.push(stack);
|
|
109
|
+
this._poll();
|
|
110
|
+
} else {
|
|
111
|
+
callback(new Error(why), /** @type {MessageStack} */ (msg));
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @private
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
_poll() {
|
|
121
|
+
clearTimeout(this.timer);
|
|
122
|
+
|
|
123
|
+
if (this.queue.length) {
|
|
124
|
+
if (this.smtp.state() == state.NOTCONNECTED) {
|
|
125
|
+
this._connect(this.queue[0]);
|
|
126
|
+
} else if (
|
|
127
|
+
this.smtp.state() == state.CONNECTED &&
|
|
128
|
+
!this.sending &&
|
|
129
|
+
this.ready
|
|
130
|
+
) {
|
|
131
|
+
this._sendmail(this.queue.shift());
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// wait around 1 seconds in case something does come in,
|
|
135
|
+
// otherwise close out SMTP connection if still open
|
|
136
|
+
else if (this.smtp.state() == state.CONNECTED) {
|
|
137
|
+
this.timer = setTimeout(() => this.smtp.quit(), 1000);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @private
|
|
143
|
+
* @param {MessageStack} stack stack
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
_connect(stack) {
|
|
147
|
+
/**
|
|
148
|
+
* @param {Error} err callback error
|
|
149
|
+
* @returns {void}
|
|
150
|
+
*/
|
|
151
|
+
const connect = err => {
|
|
152
|
+
if (!err) {
|
|
153
|
+
const begin = err => {
|
|
154
|
+
if (!err) {
|
|
155
|
+
this.ready = true;
|
|
156
|
+
this._poll();
|
|
157
|
+
} else {
|
|
158
|
+
stack.callback(err, stack.message);
|
|
159
|
+
|
|
160
|
+
// clear out the queue so all callbacks can be called with the same error message
|
|
161
|
+
this.queue.shift();
|
|
162
|
+
this._poll();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
if (!this.smtp.authorized()) {
|
|
167
|
+
this.smtp.login(begin);
|
|
168
|
+
} else {
|
|
169
|
+
this.smtp.ehlo_or_helo_if_needed(begin);
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
stack.callback(err, stack.message);
|
|
173
|
+
|
|
174
|
+
// clear out the queue so all callbacks can be called with the same error message
|
|
175
|
+
this.queue.shift();
|
|
176
|
+
this._poll();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
this.ready = false;
|
|
181
|
+
this.smtp.connect(connect);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @private
|
|
186
|
+
* @param {MessageStack} msg message stack
|
|
187
|
+
* @returns {boolean} can make message
|
|
188
|
+
*/
|
|
189
|
+
_canMakeMessage(msg) {
|
|
190
|
+
return (
|
|
191
|
+
msg.from &&
|
|
192
|
+
(msg.to || msg.cc || msg.bcc) &&
|
|
193
|
+
(msg.text !== undefined || this._containsInlinedHtml(msg.attachment))
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @private
|
|
199
|
+
* @param {*} attachment attachment
|
|
200
|
+
* @returns {boolean} does contain
|
|
201
|
+
*/
|
|
202
|
+
_containsInlinedHtml(attachment) {
|
|
203
|
+
if (Array.isArray(attachment)) {
|
|
204
|
+
return attachment.some(att => {
|
|
205
|
+
return this._isAttachmentInlinedHtml(att);
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
return this._isAttachmentInlinedHtml(attachment);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @private
|
|
214
|
+
* @param {*} attachment attachment
|
|
215
|
+
* @returns {boolean} is inlined
|
|
216
|
+
*/
|
|
217
|
+
_isAttachmentInlinedHtml(attachment) {
|
|
218
|
+
return (
|
|
219
|
+
attachment &&
|
|
220
|
+
(attachment.data || attachment.path) &&
|
|
221
|
+
attachment.alternative === true
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @private
|
|
227
|
+
* @param {MessageStack} stack stack
|
|
228
|
+
* @param {function(MessageStack): void} next next
|
|
229
|
+
* @returns {function(Error): void} callback
|
|
230
|
+
*/
|
|
231
|
+
_sendsmtp(stack, next) {
|
|
232
|
+
/**
|
|
233
|
+
* @param {Error} [err] error
|
|
234
|
+
* @returns {void}
|
|
235
|
+
*/
|
|
236
|
+
return err => {
|
|
237
|
+
if (!err && next) {
|
|
238
|
+
next.apply(this, [stack]);
|
|
239
|
+
} else {
|
|
240
|
+
// if we snag on SMTP commands, call done, passing the error
|
|
241
|
+
// but first reset SMTP state so queue can continue polling
|
|
242
|
+
this.smtp.rset(() => this._senddone(err, stack));
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @private
|
|
249
|
+
* @param {MessageStack} stack stack
|
|
250
|
+
* @returns {void}
|
|
251
|
+
*/
|
|
252
|
+
_sendmail(stack) {
|
|
253
|
+
const from = stack.returnPath || stack.from;
|
|
254
|
+
this.sending = true;
|
|
255
|
+
this.smtp.mail(this._sendsmtp(stack, this._sendrcpt), '<' + from + '>');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @private
|
|
260
|
+
* @param {MessageStack} stack stack
|
|
261
|
+
* @returns {void}
|
|
262
|
+
*/
|
|
263
|
+
_sendrcpt(stack) {
|
|
264
|
+
if (stack.to == null || typeof stack.to === 'string') {
|
|
265
|
+
throw new TypeError('stack.to must be array');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const to = stack.to.shift().address;
|
|
269
|
+
this.smtp.rcpt(
|
|
270
|
+
this._sendsmtp(stack, stack.to.length ? this._sendrcpt : this._senddata),
|
|
271
|
+
`<${to}>`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @private
|
|
277
|
+
* @param {MessageStack} stack stack
|
|
278
|
+
* @returns {void}
|
|
279
|
+
*/
|
|
280
|
+
_senddata(stack) {
|
|
281
|
+
this.smtp.data(this._sendsmtp(stack, this._sendmessage));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @private
|
|
286
|
+
* @param {MessageStack} stack stack
|
|
287
|
+
* @returns {void}
|
|
288
|
+
*/
|
|
289
|
+
_sendmessage(stack) {
|
|
290
|
+
const stream = stack.message.stream();
|
|
291
|
+
|
|
292
|
+
stream.on('data', data => this.smtp.message(data));
|
|
293
|
+
stream.on('end', () => {
|
|
294
|
+
this.smtp.data_end(
|
|
295
|
+
this._sendsmtp(stack, () => this._senddone(null, stack))
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// there is no way to cancel a message while in the DATA portion,
|
|
300
|
+
// so we have to close the socket to prevent a bad email from going out
|
|
301
|
+
stream.on('error', err => {
|
|
302
|
+
this.smtp.close();
|
|
303
|
+
this._senddone(err, stack);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @private
|
|
309
|
+
* @param {Error} err err
|
|
310
|
+
* @param {MessageStack} stack stack
|
|
311
|
+
* @returns {void}
|
|
312
|
+
*/
|
|
313
|
+
_senddone(err, stack) {
|
|
314
|
+
this.sending = false;
|
|
315
|
+
stack.callback(err, stack.message);
|
|
316
|
+
this._poll();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
203
319
|
|
|
204
320
|
exports.Client = Client;
|
|
205
321
|
|
|
206
|
-
|
|
207
|
-
{
|
|
208
|
-
|
|
209
|
-
|
|
322
|
+
/**
|
|
323
|
+
* @param {SMTPOptions} server smtp options
|
|
324
|
+
* @returns {Client} the client
|
|
325
|
+
*/
|
|
326
|
+
exports.connect = server => new Client(server);
|