X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Femailer.ts;h=bd10895308e29f213b22df00443fce3206b654c7;hb=1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7;hp=fe56688816fa24b2a8244019a4b102b595d52b30;hpb=3c7ddd7daa61d35c6fd0a992389a92599a246779;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index fe5668881..bd1089530 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -2,10 +2,10 @@ import { readFileSync } from 'fs-extra' import { isArray, merge } from 'lodash' import { createTransport, Transporter } from 'nodemailer' import { join } from 'path' +import { root } from '@shared/core-utils' import { EmailPayload } from '@shared/models' import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model' -import { isTestInstance } from '../helpers/core-utils' -import { root } from '@shared/core-utils' +import { isTestOrDevInstance } from '../helpers/core-utils' import { bunyanLogger, logger } from '../helpers/logger' import { CONFIG, isEmailEnabled } from '../initializers/config' import { WEBSERVER } from '../initializers/constants' @@ -29,7 +29,7 @@ class Emailer { this.initialized = true if (!isEmailEnabled()) { - if (!isTestInstance()) { + if (!isTestOrDevInstance()) { logger.error('Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!') } @@ -132,7 +132,8 @@ class Emailer { async sendMail (options: EmailPayload) { if (!isEmailEnabled()) { - throw new Error('Cannot send mail because SMTP is not configured.') + logger.info('Cannot send mail because SMTP is not configured.') + return } const fromDisplayName = options.from @@ -144,7 +145,7 @@ class Emailer { htmlToText: { selectors: [ { selector: 'img', format: 'skip' }, - { selector: 'a', options: { ignoreHref: true } } + { selector: 'a', options: { hideLinkHrefIfSameAsText: true } } ] }, message: { @@ -179,7 +180,7 @@ class Emailer { } } - // overriden/new variables given for a specific template in the payload + // overridden/new variables given for a specific template in the payload const sendOptions = merge(baseOptions, options) await email.send(sendOptions)