refs #5475 send email force
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-06-20 15:06:02 +02:00
parent 092471f74e
commit a8fafacb82
3 changed files with 7 additions and 6 deletions

View File

@ -52,6 +52,6 @@ module.exports = Self => {
const email = new Email(templateName, params);
return email.send();
return email.send({force: true});
};
};

View File

@ -63,12 +63,12 @@ class Email extends Component {
await getAttachments(componentPath, component.attachments);
if (component.components)
await getSubcomponentAttachments(component)
await getSubcomponentAttachments(component);
}
}
}
await getSubcomponentAttachments(instance)
await getSubcomponentAttachments(instance);
if (this.attachments)
await getAttachments(this.path, this.attachments);
@ -84,7 +84,8 @@ class Email extends Component {
replyTo: this.args.replyTo || '',
subject: localeSubject,
html: rendered,
attachments: attachments
attachments: attachments,
force: options.force
};
return smtp.send(mailOptions);

View File

@ -10,7 +10,8 @@ module.exports = {
async send(options) {
options.from = `${config.app.senderName} <${config.app.senderEmail}>`;
console.log(process.env.NODE_ENV !== 'production' && !options.force);
console.log(process.env.NODE_ENV !== 'production', !options.force);
if (process.env.NODE_ENV !== 'production') {
const notProductionError = {message: 'This not production, this email not sended'};
await this.mailLog(options, notProductionError);
@ -19,7 +20,6 @@ module.exports = {
options.to = config.app.senderEmail;
}
let error;
return this.transporter.sendMail(options).catch(err => {
error = err;