Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4e481e1

Browse files
server/utils/renderMjml: add types & named export
1 parent 380366f commit 4e481e1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎server/utils/renderMjml.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
/* eslint-disable consistent-return */
12
import mjml2html from 'mjml';
23

3-
export default (template) => {
4+
/** Parse template string containing mjml tags into html for nodemailer.SendMailOptions.html */
5+
export function renderMjml(template: string): string | undefined {
46
try {
57
const output = mjml2html(template);
68
return output.html;
79
} catch (e) {
810
console.error(e);
9-
// fall through to null
11+
// fall through to undefined (null is not valid for nodemailer.SendMailOptions.html)
12+
return undefined;
1013
}
11-
12-
return null;
13-
};
14+
}

‎server/views/mail.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import renderMjml from '../utils/renderMjml';
1+
import {renderMjml} from '../utils/renderMjml';
22
import { mailLayout } from './mailLayout';
33
import { consolidationMailLayout } from './consolidationMailLayout';
44

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /