fix: initial fix for mail logger (#2798)

Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
This commit is contained in:
Sargam
2024-06-26 15:52:37 +05:45
committed by GitHub
parent b8efc442e3
commit 81a4da6199
2 changed files with 11639 additions and 14390 deletions

View File

@@ -62,26 +62,23 @@ const getEmailSubject = (productName: string): string => {
};
export const sendEmail = async (emailData: SendEmailDataProps) => {
if (IS_SMTP_CONFIGURED) {
const transporter = nodemailer.createTransport({
host: SMTP_HOST,
port: SMTP_PORT,
secure: SMTP_SECURE_ENABLED, // true for 465, false for other ports
auth: {
user: SMTP_USER,
pass: SMTP_PASSWORD,
},
logger: DEBUG,
debug: DEBUG,
} as SMTPTransport.Options);
const emailDefaults = {
from: `Formbricks <${MAIL_FROM ?? "noreply@formbricks.com"}>`,
};
await transporter.sendMail({ ...emailDefaults, ...emailData });
} else {
// eslint-disable-next-line no-console -- necessary for logging email configuration errors
console.error(`Could not Email :: SMTP not configured :: ${emailData.subject}`);
}
if (!IS_SMTP_CONFIGURED) return;
const transporter = nodemailer.createTransport({
host: SMTP_HOST,
port: SMTP_PORT,
secure: SMTP_SECURE_ENABLED, // true for 465, false for other ports
auth: {
user: SMTP_USER,
pass: SMTP_PASSWORD,
},
logger: DEBUG,
debug: DEBUG,
} as SMTPTransport.Options);
const emailDefaults = {
from: `Formbricks <${MAIL_FROM ?? "noreply@formbricks.com"}>`,
};
await transporter.sendMail({ ...emailDefaults, ...emailData });
};
export const sendVerificationEmail = async (user: TEmailUser) => {

25992
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff