mirror of
https://github.com/directus/directus.git
synced 2026-02-08 18:24:55 -05:00
Fix issue that would cause emails to be displayed incorrectly in certain email clients (#6267)
Fixes #6074
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user