mirror of
https://github.com/directus/directus.git
synced 2026-01-23 17:58:23 -05:00
Fix issue that would cause emails to be displayed incorrectly in certain email clients (#6267)
Fixes #6074
This commit is contained in:
@@ -125,6 +125,7 @@
|
||||
"otplib": "^12.0.1",
|
||||
"pino": "^6.11.3",
|
||||
"pino-colada": "^2.1.0",
|
||||
"prettier": "^2.3.1",
|
||||
"qs": "^6.9.4",
|
||||
"rate-limiter-flexible": "^2.2.2",
|
||||
"resolve-cwd": "^3.0.0",
|
||||
|
||||
@@ -9,6 +9,7 @@ import logger from '../../logger';
|
||||
import { AbstractServiceOptions, Accountability, SchemaOverview } from '../../types';
|
||||
import getMailer from '../../mailer';
|
||||
import { Transporter, SendMailOptions } from 'nodemailer';
|
||||
import prettier from 'prettier';
|
||||
|
||||
const liquidEngine = new Liquid({
|
||||
root: [path.resolve(env.EXTENSIONS_PATH, 'templates'), path.resolve(__dirname, 'templates')],
|
||||
@@ -61,6 +62,11 @@ export class MailService {
|
||||
html = await this.renderTemplate(template.name, templateData);
|
||||
}
|
||||
|
||||
if (typeof html === 'string') {
|
||||
// Some email clients start acting funky when line length exceeds 75 characters. See #6074
|
||||
html = prettier.format(html as string, { parser: 'html', printWidth: 70, tabWidth: 0 });
|
||||
}
|
||||
|
||||
try {
|
||||
await this.mailer.sendMail({ ...emailOptions, from, html });
|
||||
} catch (error) {
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -116,6 +116,7 @@
|
||||
"otplib": "^12.0.1",
|
||||
"pino": "^6.11.3",
|
||||
"pino-colada": "^2.1.0",
|
||||
"prettier": "^2.3.1",
|
||||
"qs": "^6.9.4",
|
||||
"rate-limiter-flexible": "^2.2.2",
|
||||
"resolve-cwd": "^3.0.0",
|
||||
@@ -72858,6 +72859,7 @@
|
||||
"pg": "^8.6.0",
|
||||
"pino": "^6.11.3",
|
||||
"pino-colada": "^2.1.0",
|
||||
"prettier": "*",
|
||||
"qs": "^6.9.4",
|
||||
"rate-limiter-flexible": "^2.2.2",
|
||||
"resolve-cwd": "^3.0.0",
|
||||
|
||||
Reference in New Issue
Block a user