-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathemail.ts
More file actions
56 lines (51 loc) · 1.46 KB
/
email.ts
File metadata and controls
56 lines (51 loc) · 1.46 KB
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
48
49
50
51
52
53
54
55
56
import c from "config";
import { smtpSender, etherealSender } from "email";
import RSVPConfirmationEmail from "email/templates/rsvp-confirmation";
import RegistrationSuccessEmail from "email/templates/registration-confirmation";
// const mailer = smtpSender({
// host: process.env.SMTP_HOST,
// port: Number(process.env.SMTP_PORT),
// secure: process.env.SMTP_SECURE === "true",
// auth: {
// user: process.env.SMTP_USER,
// pass: process.env.SMTP_PASS,
// },
// });
// Testing mailer
const mailer = etherealSender();
export const sendRSVPConfirmationEmail = async (email: string, props?: any) => {
if (c.featureFlags.extra.emailService) {
await mailer.send({
from: "<[EMAIL_ADDRESS]>",
to: email,
subject: "RSVP Confirmation",
text: "You have been successfully RSVPed to the event!",
body: RSVPConfirmationEmail(props),
});
}
};
export const sendRegistrationSuccessEmail = async (
email: string,
props?: any,
) => {
if (c.featureFlags.extra.emailService) {
await mailer.send({
from: "<[EMAIL_ADDRESS]>",
to: email,
subject: "Registration Confirmation",
text: "You have been successfully registered!",
body: RegistrationSuccessEmail(props),
});
}
};
export const sendExampleEmail = async (email: string) => {
if (c.featureFlags.extra.emailService) {
await mailer.send({
from: "<[EMAIL_ADDRESS]>",
to: email,
subject: "Example Email",
text: "This is an example email.",
body: "This is an example email.",
});
}
};