diff --git a/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx b/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx index be67afa..4e8ac16 100644 --- a/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx +++ b/apps/infoalloggi/src/pages/area-riservata/admin/edit-annuncio/[id].tsx @@ -57,7 +57,7 @@ const AnnuncioEdit: NextPageWithLayout = ({ if (!data) { return ; } - + //todo avere scheda di condivizione scaricabile return ( <> diff --git a/apps/infoalloggi/src/server/services/mailer.ts b/apps/infoalloggi/src/server/services/mailer.ts index 1b2a9c1..5dcbd03 100644 --- a/apps/infoalloggi/src/server/services/mailer.ts +++ b/apps/infoalloggi/src/server/services/mailer.ts @@ -203,31 +203,28 @@ export const NewMail = async ({ db: db, id: "EMAIL_OFF", }); - if (emailFlag === "true") { + if (emailFlag == "false") { + try { + const { html } = await genMail({ ...mail }); + await mailer({ + to: to, + subject: subject, + html, + }); + } catch (e) { + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: "Errore nell'invio dell'email: " + (e as Error).message, + }); + } + } else { console.warn( `Email sending is disabled to:${to} subj:${subject} msgType: ${mail.mailType}`, ); - return { - success: true, - message: `Email sending is disabled to:${to} subj:${subject} msgType: ${mail.mailType}`, - }; } - try { - const { html } = await genMail({ ...mail }); - await mailer({ - to: to, - subject: subject, - html, - }); - if (userId) { - // Store the email in the database if userId is provided - await StoreEmail({ userId, data: mail }); - } - } catch (e) { - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: "Errore nell'invio dell'email: " + (e as Error).message, - }); + if (userId) { + // Store the email in the database if userId is provided + await StoreEmail({ userId, data: mail }); } };