(options: { to: string; subject: string; body: string })
| 16 | : null; |
| 17 | |
| 18 | export const sendEmail = async (options: { to: string; subject: string; body: string }) => { |
| 19 | const bodyHtml = await marked.parseInline(options.body, { mangle: false }); |
| 20 | |
| 21 | try { |
| 22 | if (!transporter) { |
| 23 | console.log("Sent email (fake):", options); |
| 24 | return; |
| 25 | } |
| 26 | await transporter.sendMail({ |
| 27 | from: env.SENDER_EMAIL, |
| 28 | to: options.to, |
| 29 | subject: options.subject, |
| 30 | html: bodyHtml, |
| 31 | text: options.body, |
| 32 | }); |
| 33 | } catch (error) { |
| 34 | console.error("error sending email", error); |
| 35 | throw error; |
| 36 | } |
| 37 | }; |
no outgoing calls
no test coverage detected