| 16 | } |
| 17 | |
| 18 | async send({ to, from, replyTo, subject, react }: MailMessage): Promise<void> { |
| 19 | const result = await this.#client.emails.send({ |
| 20 | from: from, |
| 21 | to, |
| 22 | replyTo: replyTo, |
| 23 | subject, |
| 24 | react, |
| 25 | }); |
| 26 | |
| 27 | if (result.error) { |
| 28 | console.log(result); |
| 29 | console.error( |
| 30 | `Failed to send email to ${to}, ${subject}. Error ${result.error.name}: ${result.error.message}` |
| 31 | ); |
| 32 | throw new EmailError(result.error); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | async sendPlainText({ to, from, replyTo, subject, text, html }: PlainTextMailMessage): Promise<void> { |
| 37 | const result = await this.#client.emails.send({ |