mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-03 17:44:44 +02:00
setup react email and nodemailer
This commit is contained in:
parent
c9d98a8e8c
commit
57ebc0e525
11 changed files with 2497 additions and 4754 deletions
33
server/emails/index.ts
Normal file
33
server/emails/index.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
export * from "@server/emails/sendEmail";
|
||||
|
||||
import nodemailer from "nodemailer";
|
||||
import environment from "@server/environment";
|
||||
import logger from "@server/logger";
|
||||
|
||||
function createEmailClient() {
|
||||
if (
|
||||
!environment.EMAIL_SMTP_HOST ||
|
||||
!environment.EMAIL_SMTP_PORT ||
|
||||
!environment.EMAIL_SMTP_USER ||
|
||||
!environment.EMAIL_SMTP_PASS
|
||||
) {
|
||||
logger.warn(
|
||||
"Email SMTP configuration is missing. Emails will not be sent.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return nodemailer.createTransport({
|
||||
host: environment.EMAIL_SMTP_HOST,
|
||||
port: environment.EMAIL_SMTP_PORT,
|
||||
secure: false,
|
||||
auth: {
|
||||
user: environment.EMAIL_SMTP_USER,
|
||||
pass: environment.EMAIL_SMTP_PASS,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const emailClient = createEmailClient();
|
||||
|
||||
export default emailClient;
|
Loading…
Add table
Add a link
Reference in a new issue