mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 02:06:41 +00:00
setup react email and nodemailer
This commit is contained in:
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;
|
||||
Reference in New Issue
Block a user