Function
sendMailjetMail
({
from,
to,
subject,
html,
}: MailOptions)
Source from the content-addressed store, hash-verified
| 14 | ); |
| 15 | |
| 16 | export async function sendMailjetMail({ |
| 17 | from, |
| 18 | to, |
| 19 | subject, |
| 20 | html, |
| 21 | }: MailOptions) { |
| 22 | const data: SendEmailV3_1.Body = { |
| 23 | Messages: [ |
| 24 | { |
| 25 | From: { |
| 26 | Name: from.name, |
| 27 | Email: from.email, |
| 28 | }, |
| 29 | |
| 30 | To: to.map((email) => ({ |
| 31 | Email: email, |
| 32 | })), |
| 33 | |
| 34 | Subject: iif(process.env.DEV, '[Mailjet] ', '') + subject, |
| 35 | |
| 36 | HTMLPart: html, |
| 37 | }, |
| 38 | ], |
| 39 | }; |
| 40 | |
| 41 | await _getMailjet() |
| 42 | .post('send', { version: 'v3.1' }) |
| 43 | .request(data as any); |
| 44 | } |
Tested by
no test coverage detected