Compare commits

...

2 Commits

Author SHA1 Message Date
8427d348dd fix: ensure smtp metadata logger doesn't crash in tests
Some checks failed
🚀 Build & Deploy / 🔍 Prepare (push) Successful in 4s
🚀 Build & Deploy / 🧪 QA (push) Successful in 2m13s
🚀 Build & Deploy / 🏗️ Build (push) Successful in 14m2s
🚀 Build & Deploy / 🚀 Deploy (push) Successful in 11s
🚀 Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 2m51s
🚀 Build & Deploy / 🔔 Notify (push) Successful in 2s
Nightly QA / call-qa-workflow (push) Failing after 40s
2026-04-15 00:05:45 +02:00
7109b3c32e fix: add detailed smtp logging to debug confirmation email
Some checks failed
🚀 Build & Deploy / 🔍 Prepare (push) Successful in 4s
🚀 Build & Deploy / 🧪 QA (push) Failing after 49s
🚀 Build & Deploy / 🚀 Deploy (push) Has been skipped
🚀 Build & Deploy / 🏗️ Build (push) Successful in 13m44s
🚀 Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
🚀 Build & Deploy / 🔔 Notify (push) Successful in 2s
2026-04-14 22:28:45 +02:00
2 changed files with 18 additions and 10 deletions

View File

@@ -115,16 +115,23 @@ export async function POST(req: Request) {
}), }),
); );
await transporter.sendMail({ try {
from: config.mail.from, const info = await transporter.sendMail({
to, from: config.mail.from,
replyTo: email, to,
subject: `Kontaktanfrage von ${name}`, replyTo: email,
html: notificationHtml, subject: `Kontaktanfrage von ${name}`,
}); html: notificationHtml,
});
logger.info("Notification email sent successfully", { messageId: info?.messageId });
} catch (notifyError) {
logger.error("Failed to send notification email", { error: notifyError });
throw notifyError; // Re-throw to be caught by the outer SMTP catch
}
// 2b. Confirmation to the User // 2b. Confirmation to the User
try { try {
logger.info("Preparing to send confirmation email", { to: email });
const confirmationHtml = await render( const confirmationHtml = await render(
React.createElement(ConfirmationMessage, { React.createElement(ConfirmationMessage, {
name, name,
@@ -132,16 +139,17 @@ export async function POST(req: Request) {
}), }),
); );
await transporter.sendMail({ const info = await transporter.sendMail({
from: config.mail.from, from: config.mail.from,
to: email, to: email,
subject: `Ihre Kontaktanfrage bei ${clientName}`, subject: `Ihre Kontaktanfrage bei ${clientName}`,
html: confirmationHtml, html: confirmationHtml,
}); });
logger.info("Confirmation email sent successfully", { messageId: info?.messageId });
} catch (confirmError) { } catch (confirmError) {
logger.warn( logger.warn(
"Failed to send confirmation email, but notification was sent", "Failed to send confirmation email, but notification was sent",
{ error: confirmError }, { error: confirmError instanceof Error ? confirmError.message : String(confirmError) },
); );
} }

View File

@@ -8,7 +8,7 @@ const { mockCreate, mockSendEmail } = vi.hoisted(() => ({
// Mock Nodemailer // Mock Nodemailer
const { mockSendMail } = vi.hoisted(() => ({ const { mockSendMail } = vi.hoisted(() => ({
mockSendMail: vi.fn(), mockSendMail: vi.fn().mockResolvedValue({ messageId: "mock-message-id" }),
})); }));
vi.mock("nodemailer", () => ({ vi.mock("nodemailer", () => ({