-
Notifications
You must be signed in to change notification settings - Fork 2
/
layoutTemplate.ts
34 lines (30 loc) · 883 Bytes
/
layoutTemplate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { createTransport } from "nodemailer";
import { nodemailerMjmlPlugin } from "../src/index";
import { join } from "path";
const transport = createTransport({
host: "localhost",
port: 25
});
transport.use(
"compile",
nodemailerMjmlPlugin({ templateFolder: join(__dirname, "mailTemplates") })
);
const sendTemplatedEmail = async () => {
await transport.sendMail({
from: '"John doe" <john.doe@example.com>',
to: "doe.john@.com",
subject: "Welcome",
templateLayoutName: "layoutTemplate",
templateLayoutSlots: {
header: "partials/header",
content: "partials/content",
footer: "partials/footer",
},
templateData: {
content: {
imageURL: "http://5vph.mj.am/img/5vph/b/1g8pi/068ys.png"
}
}
});
};
sendTemplatedEmail();