warnFix: smtp prevents the sending of emails depending on the condition
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
e994e54e4b
commit
69c3a49cce
|
@ -10,16 +10,17 @@ module.exports = {
|
||||||
|
|
||||||
async send(options) {
|
async send(options) {
|
||||||
options.from = `${config.app.senderName} <${config.app.senderEmail}>`;
|
options.from = `${config.app.senderName} <${config.app.senderEmail}>`;
|
||||||
if (!process.env.NODE_ENV)
|
const env = process.env.NODE_ENV;
|
||||||
options.to = config.app.senderEmail;
|
const canSend = env === 'production' || !env || options.force;
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production' && !options.force) {
|
if (!canSend || !config.smtp.auth.user) {
|
||||||
const notProductionError = {message: 'This not production, this email not sended'};
|
const notProductionError = {message: 'This not production, this email not sended'};
|
||||||
await this.mailLog(options, notProductionError);
|
await this.mailLog(options, notProductionError);
|
||||||
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.smtp.auth.user)
|
if (!env)
|
||||||
return Promise.resolve(true);
|
options.to = config.app.senderEmail;
|
||||||
|
|
||||||
let res;
|
let res;
|
||||||
let error;
|
let error;
|
||||||
|
|
Loading…
Reference in New Issue