Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/lib/server/startup/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { settings } from '../../../settings';

settings.addGroup('Email', function() {
this.section('Style', function() {
this.add('email_plain_text_only', false, {
type: 'boolean',
});

this.add('email_style', `html, body, .body { font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Helvetica Neue','Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Meiryo UI',Arial,sans-serif; }

body, .body {
Expand Down Expand Up @@ -103,6 +107,10 @@ settings.addGroup('Email', function() {
multiline: true,
i18nLabel: 'email_style_label',
i18nDescription: 'email_style_description',
enableQuery: {
_id: 'email_plain_text_only',
value: false,
},
});
});

Expand Down
12 changes: 11 additions & 1 deletion app/mailer/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ export const replaceEscaped = (str, data = {}) => replace(str, {
return ret;
}, {}),
});
export const wrap = (html, data = {}) => replaceEscaped(body.replace('{{body}}', html), data);
export const wrap = (html, data = {}) => {
if (settings.get('email_plain_text_only')) {
return replace(html, data);
Comment thread
sampaiodiego marked this conversation as resolved.
Resolved
}

return replaceEscaped(body.replace('{{body}}', html), data);
};
export const inlinecss = (html) => juice.inlineContent(html, Settings.get('email_style'));
export const getTemplate = (template, fn, escape = true) => {
let html = '';
Expand Down Expand Up @@ -103,6 +109,10 @@ export const sendNoWrap = ({ to, from, replyTo, subject, html, text, headers })
text = stripHtml(html);
}

if (settings.get('email_plain_text_only')) {
html = undefined;
}

Meteor.defer(() => Email.send({ to, from, replyTo, subject, html, text, headers }));
};

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,7 @@
"email_style_label": "Email Style",
"email_style_description": "Avoid nested selectors",
"Email_verified": "Email verified",
"email_plain_text_only": "Send only plain text emails",
"Emoji": "Emoji",
"Emoji_provided_by_JoyPixels": "Emoji provided by <strong>JoyPixels</strong>",
"EmojiCustomFilesystem": "Custom Emoji Filesystem",
Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@
"Email_subject": "Assunto",
"email_style_label": "Estilo do Email",
"email_style_description": "Evite seletores aninhados",
"email_plain_text_only": "Enviar emails apenas em texto puro",
"Email_verified": "Email verificado",
"Emoji": "Emoji",
"EmojiCustomFilesystem": "Sistema de arquivos do emoji customizado",
Expand Down