-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create form to send email to all site collaborators (#1368)
* feat: create form to send email to all site collaborators * chore: remove extra console.log statement * chore: update error message
- Loading branch information
Showing
12 changed files
with
467 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,14 +43,38 @@ class MailClient { | |
subject: string, | ||
body: string, | ||
attachments?: string[] | ||
): Promise<void> { | ||
await this.sendMailWithCc( | ||
recipient, | ||
"IsomerCMS", | ||
[], | ||
"[email protected]", | ||
subject, | ||
body, | ||
attachments | ||
) | ||
} | ||
|
||
async sendMailWithCc( | ||
recipient: string, | ||
senderName: string, | ||
cc: string[], | ||
replyTo: string, | ||
subject: string, | ||
body: string, | ||
attachments?: string[] | ||
): Promise<void> { | ||
const sendEndpoint = `${POSTMAN_API_URL}/transactional/email/send` | ||
const form = new FormData() | ||
form.append("subject", subject) | ||
form.append("from", "IsomerCMS <[email protected]>") | ||
form.append("from", `${senderName} <[email protected]>`) | ||
form.append("body", body) | ||
form.append("recipient", recipient) | ||
form.append("reply_to", "[email protected]") | ||
form.append("reply_to", replyTo) | ||
cc.forEach((ccEmail) => { | ||
form.append("cc", ccEmail) | ||
}) | ||
|
||
if (attachments) { | ||
await Promise.all( | ||
attachments?.map(async (attachment) => { | ||
|
Oops, something went wrong.