mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-12 02:42:27 +07:00
node_modules: update (#344)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
b099186883
commit
6e88c72525
63 files changed
+2863
-1227
No files matched your search
+23
-7
@@ -119,6 +119,11 @@ class Mail extends EventEmitter {
|
||||
this.getSocket = false;
|
||||
}
|
||||
const mail = new MailMessage(this, data);
|
||||
// a failed message is not going to be read anymore, release its content streams
|
||||
const fail = (err) => {
|
||||
mail.releaseStreams();
|
||||
done(err);
|
||||
};
|
||||
this.logger.debug({
|
||||
tnx: 'transport',
|
||||
name: this.transporter.name,
|
||||
@@ -132,7 +137,7 @@ class Mail extends EventEmitter {
|
||||
tnx: 'plugin',
|
||||
action: 'compile'
|
||||
}, 'PluginCompile Error: %s', err.message);
|
||||
return done(err);
|
||||
return fail(err);
|
||||
}
|
||||
let recipientCount;
|
||||
try {
|
||||
@@ -149,7 +154,7 @@ class Mail extends EventEmitter {
|
||||
tnx: 'transport',
|
||||
action: 'send'
|
||||
}, 'Compile Error: %s', err.message);
|
||||
return done(err);
|
||||
return fail(err);
|
||||
}
|
||||
const maxRecipients = mail.data.maxRecipients === undefined ? DEFAULT_MAX_RECIPIENTS : mail.data.maxRecipients;
|
||||
if (maxRecipients && recipientCount > maxRecipients) {
|
||||
@@ -160,7 +165,7 @@ class Mail extends EventEmitter {
|
||||
tnx: 'transport',
|
||||
action: 'send'
|
||||
}, 'Send Error: %s', err.message);
|
||||
return done(err);
|
||||
return fail(err);
|
||||
}
|
||||
this._processPlugins('stream', mail, err => {
|
||||
if (err) {
|
||||
@@ -169,7 +174,7 @@ class Mail extends EventEmitter {
|
||||
tnx: 'plugin',
|
||||
action: 'stream'
|
||||
}, 'PluginStream Error: %s', err.message);
|
||||
return done(err);
|
||||
return fail(err);
|
||||
}
|
||||
if (mail.data.dkim || this.dkim) {
|
||||
mail.message.processFunc(input => {
|
||||
@@ -184,6 +189,7 @@ class Mail extends EventEmitter {
|
||||
}
|
||||
this.transporter.send(mail, (...args) => {
|
||||
if (args[0]) {
|
||||
mail.releaseStreams();
|
||||
this.logger.error({
|
||||
err: args[0],
|
||||
tnx: 'transport',
|
||||
@@ -251,6 +257,11 @@ class Mail extends EventEmitter {
|
||||
// setup socket handler for the mailer object
|
||||
this.getSocket = (options, callback) => {
|
||||
const protocol = proxy.protocol.replace(/:$/, '').toLowerCase();
|
||||
// The proxy handshake is a part of connecting and draws from the same deadline as the
|
||||
// SMTP connection that follows it: whatever the proxy takes, the connection does not get
|
||||
const configuredTimeout = Number(this.options.connectionTimeout) || 0;
|
||||
const connectStartedAt = Number(options.connectStartedAt) || Date.now();
|
||||
const connectionTimeout = configuredTimeout ? Math.max(connectStartedAt + configuredTimeout - Date.now(), 1) : undefined;
|
||||
if (this.meta.has('proxy_handler_' + protocol)) {
|
||||
return this.meta.get('proxy_handler_' + protocol)(proxy, options, callback);
|
||||
}
|
||||
@@ -258,7 +269,7 @@ class Mail extends EventEmitter {
|
||||
// Connect using a HTTP CONNECT method
|
||||
case 'http':
|
||||
case 'https':
|
||||
httpProxyClient(proxy.href, options.port, options.host, this.options.tls || {}, (err, socket) => {
|
||||
httpProxyClient(proxy.href, options.port, options.host, connectionTimeout ? Object.assign({}, this.options.tls, { timeout: connectionTimeout }) : this.options.tls || {}, (err, socket) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@@ -292,6 +303,9 @@ class Mail extends EventEmitter {
|
||||
},
|
||||
command: 'connect'
|
||||
};
|
||||
if (connectionTimeout) {
|
||||
connectionOpts.timeout = connectionTimeout;
|
||||
}
|
||||
if (proxy.username || proxy.password) {
|
||||
const username = proxy.username || '';
|
||||
const password = proxy.password || '';
|
||||
@@ -321,11 +335,13 @@ class Mail extends EventEmitter {
|
||||
if (net.isIP(proxy.hostname)) {
|
||||
return connect(proxy.hostname);
|
||||
}
|
||||
return dns.resolve(proxy.hostname, (err, address) => {
|
||||
// lookup goes through the hosts file and returns an IPv6 address as well,
|
||||
// the same way a connection to the proxy host would be resolved otherwise
|
||||
return dns.lookup(proxy.hostname, (err, address) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
connect(Array.isArray(address) ? address[0] : address);
|
||||
connect(address);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user