mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-05-06 17:30:35 +07:00
node_modules: update (#290)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
64
node_modules/nodemailer/lib/smtp-transport/index.js
generated
vendored
64
node_modules/nodemailer/lib/smtp-transport/index.js
generated
vendored
@@ -49,11 +49,8 @@ class SMTPTransport extends EventEmitter {
|
||||
component: this.options.component || 'smtp-transport'
|
||||
});
|
||||
|
||||
// temporary object
|
||||
let connection = new SMTPConnection(this.options);
|
||||
|
||||
this.name = 'SMTP';
|
||||
this.version = packageData.version + '[client:' + connection.version + ']';
|
||||
this.version = packageData.version + '[client:' + packageData.version + ']';
|
||||
|
||||
if (this.options.auth) {
|
||||
this.auth = this.getAuth({});
|
||||
@@ -77,24 +74,13 @@ class SMTPTransport extends EventEmitter {
|
||||
return this.auth;
|
||||
}
|
||||
|
||||
let hasAuth = false;
|
||||
let authData = {};
|
||||
const authData = Object.assign(
|
||||
{},
|
||||
this.options.auth && typeof this.options.auth === 'object' ? this.options.auth : {},
|
||||
authOpts && typeof authOpts === 'object' ? authOpts : {}
|
||||
);
|
||||
|
||||
if (this.options.auth && typeof this.options.auth === 'object') {
|
||||
Object.keys(this.options.auth).forEach(key => {
|
||||
hasAuth = true;
|
||||
authData[key] = this.options.auth[key];
|
||||
});
|
||||
}
|
||||
|
||||
if (authOpts && typeof authOpts === 'object') {
|
||||
Object.keys(authOpts).forEach(key => {
|
||||
hasAuth = true;
|
||||
authData[key] = authOpts[key];
|
||||
});
|
||||
}
|
||||
|
||||
if (!hasAuth) {
|
||||
if (Object.keys(authData).length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,7 +89,7 @@ class SMTPTransport extends EventEmitter {
|
||||
if (!authData.service && !authData.user) {
|
||||
return false;
|
||||
}
|
||||
let oauth2 = new XOAuth2(authData, this.logger);
|
||||
const oauth2 = new XOAuth2(authData, this.logger);
|
||||
oauth2.provisionCallback = (this.mailer && this.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
|
||||
oauth2.on('token', token => this.mailer.emit('token', token));
|
||||
oauth2.on('error', err => this.emit('error', err));
|
||||
@@ -160,13 +146,10 @@ class SMTPTransport extends EventEmitter {
|
||||
);
|
||||
|
||||
// only copy options if we need to modify it
|
||||
options = shared.assign(false, options);
|
||||
Object.keys(socketOptions).forEach(key => {
|
||||
options[key] = socketOptions[key];
|
||||
});
|
||||
options = Object.assign(shared.assign(false, options), socketOptions);
|
||||
}
|
||||
|
||||
let connection = new SMTPConnection(options);
|
||||
const connection = new SMTPConnection(options);
|
||||
|
||||
connection.once('error', err => {
|
||||
if (returned) {
|
||||
@@ -182,13 +165,13 @@ class SMTPTransport extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
let timer = setTimeout(() => {
|
||||
const timer = setTimeout(() => {
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
returned = true;
|
||||
// still have not returned, this means we have an unexpected connection close
|
||||
let err = new Error('Unexpected socket close');
|
||||
const err = new Error('Unexpected socket close');
|
||||
if (connection && connection._socket && connection._socket.upgrading) {
|
||||
// starttls connection errors
|
||||
err.code = errors.ETLS;
|
||||
@@ -203,11 +186,11 @@ class SMTPTransport extends EventEmitter {
|
||||
}
|
||||
});
|
||||
|
||||
let sendMessage = () => {
|
||||
let envelope = mail.message.getEnvelope();
|
||||
let messageId = mail.message.messageId();
|
||||
const sendMessage = () => {
|
||||
const envelope = mail.message.getEnvelope();
|
||||
const messageId = mail.message.messageId();
|
||||
|
||||
let recipients = [].concat(envelope.to || []);
|
||||
const recipients = [].concat(envelope.to || []);
|
||||
if (recipients.length > 3) {
|
||||
recipients.push('...and ' + recipients.splice(2).length + ' more');
|
||||
}
|
||||
@@ -272,7 +255,7 @@ class SMTPTransport extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
let auth = this.getAuth(mail.data.auth);
|
||||
const auth = this.getAuth(mail.data.auth);
|
||||
|
||||
if (auth && (connection.allowsAuth || options.forceAuth)) {
|
||||
connection.login(auth, err => {
|
||||
@@ -335,13 +318,10 @@ class SMTPTransport extends EventEmitter {
|
||||
options.port || ''
|
||||
);
|
||||
|
||||
options = shared.assign(false, options);
|
||||
Object.keys(socketOptions).forEach(key => {
|
||||
options[key] = socketOptions[key];
|
||||
});
|
||||
options = Object.assign(shared.assign(false, options), socketOptions);
|
||||
}
|
||||
|
||||
let connection = new SMTPConnection(options);
|
||||
const connection = new SMTPConnection(options);
|
||||
let returned = false;
|
||||
|
||||
connection.once('error', err => {
|
||||
@@ -361,7 +341,7 @@ class SMTPTransport extends EventEmitter {
|
||||
return callback(new Error('Connection closed'));
|
||||
});
|
||||
|
||||
let finalize = () => {
|
||||
const finalize = () => {
|
||||
if (returned) {
|
||||
return;
|
||||
}
|
||||
@@ -375,7 +355,7 @@ class SMTPTransport extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
let authData = this.getAuth({});
|
||||
const authData = this.getAuth({});
|
||||
|
||||
if (authData && (connection.allowsAuth || options.forceAuth)) {
|
||||
connection.login(authData, err => {
|
||||
@@ -392,7 +372,7 @@ class SMTPTransport extends EventEmitter {
|
||||
finalize();
|
||||
});
|
||||
} else if (!authData && connection.allowsAuth && options.forceAuth) {
|
||||
let err = new Error('Authentication info was not provided');
|
||||
const err = new Error('Authentication info was not provided');
|
||||
err.code = errors.ENOAUTH;
|
||||
|
||||
returned = true;
|
||||
|
||||
Reference in New Issue
Block a user