log email result and subject
This commit is contained in:
@@ -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 {};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user