-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
75 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Hello, | ||
A zipped archive of {{title}} with accession: {{accession}} has been created. Your download will be available for 24 hours. | ||
|
||
The zip file can be downloaded from {{downloadKey}} | ||
Your request for {{fileType}} download of {{fileSetLabel}} (file set id: {{fileSetId}}) has been fulfilled. Your download will be available for 24 hours. | ||
|
||
The zip file can be downloaded from {{downloadLink}} |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { SESClient, SendTemplatedEmailCommand } = require("@aws-sdk/client-ses"); | ||
|
||
module.exports.handler = async (event) => { | ||
console.log("SEND EMAIL LAMBDA"); | ||
console.log(event); | ||
|
||
const sesClient = new SESClient(); | ||
const templateName = event.template; | ||
const toAddress = event.to; | ||
const fromAddress = event.from; | ||
|
||
const params = event.params | ||
const sendTemplatedEmailCommand = createSendTemplatedEmailCommand( | ||
toAddress, | ||
fromAddress, | ||
templateName, | ||
params | ||
); | ||
|
||
try { | ||
const result = await sesClient.send(sendTemplatedEmailCommand); | ||
console.log("sendTemplatedEmailCommand", result) | ||
} catch (err) { | ||
console.log("Failed to send template email", err); | ||
return err; | ||
} | ||
return {success: true} | ||
}; | ||
|
||
|
||
const createSendTemplatedEmailCommand = ( | ||
toAddress, | ||
fromAddress, | ||
templateName, | ||
params | ||
) => { | ||
return new SendTemplatedEmailCommand({ | ||
Destination: { ToAddresses: [toAddress] }, | ||
TemplateData: JSON.stringify(params), | ||
Source: `Northwestern University Libraries <${fromAddress}>`, | ||
Template: templateName, | ||
}); | ||
}; |
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