-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.ts
47 lines (42 loc) · 1.21 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
import { sendMail, sendSimpleMail } from "./mod.ts";
// This is a throwaway key for testing a limited number of emails only,
// from a throwaway account. Sorta like giving you my keys, but the keys
// are to an outhouse.
const key =
"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";
let result = await sendMail(
{
personalizations: [{
subject: "Hello world",
to: [{ email: "[email protected]" }],
dynamicTemplateData: {
firstName: "Greg",
lastName: "Pasquariello",
email: "[email protected]",
},
}],
from: { email: "[email protected]" },
content: [
{ type: "text/plain", value: "Hello world" },
{ type: "text/html", value: "<h1>Hello world</h1>" },
],
templateId: "d-0f4e9fbba9a84ac3800fe3373be7f891",
},
{ apiKey: key },
);
console.log(result);
// await sendSimpleMail(
// {
// subject: "Hello world",
// to: [{ email: "[email protected]" }],
// from: { email: "[email protected]" },
// content: [
// { type: "text/plain", value: "Hello world" },
// { type: "text/html", value: "<h1>Hello world</h1>" },
// ],
// },
// {
// apiKey: "REDACTED",
// },
// );
console.log("Done");