log email result and subject

This commit is contained in:
Helena
2025-08-28 17:30:32 +03:00
parent 5ee161f482
commit 7d1400fba6

View File

@@ -6,6 +6,7 @@ import { emailSchema } from '@/lib/validations/email.schema';
import { renderDoctorSummaryReceivedEmail } from '@kit/email-templates'; import { renderDoctorSummaryReceivedEmail } from '@kit/email-templates';
import { getMailer } from '@kit/mailers'; import { getMailer } from '@kit/mailers';
import { enhanceAction } from '@kit/next/actions'; import { enhanceAction } from '@kit/next/actions';
import { getLogger } from '@kit/shared/logger';
export const sendDoctorSummaryCompletedEmail = async ( export const sendDoctorSummaryCompletedEmail = async (
language: string, language: string,
@@ -49,12 +50,18 @@ export const sendCompanyOfferEmail = async (
export const sendEmail = enhanceAction( export const sendEmail = enhanceAction(
async ({ subject, html, to }) => { async ({ subject, html, to }) => {
const mailer = await getMailer(); const mailer = await getMailer();
await mailer.sendEmail({ const log = await getLogger();
const result = await mailer.sendEmail({
to, to,
subject, subject,
html, html,
}); });
log.info(
`Sent email with subject "${subject}", result: ${JSON.stringify(result)}`,
);
return {}; return {};
}, },
{ {