-
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
11 changed files
with
303 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> | ||
<html xmlns='http://www.w3.org/1999/xhtml'> | ||
<head> | ||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> | ||
<title>NUL Meadow Download</title> | ||
<meta content='IE=edge' http-equiv='X-UA-Compatible' /> | ||
<style> | ||
p { | ||
margin-top: 0; | ||
line-height: 1.4em; | ||
} | ||
a { | ||
color: #4e2a84; | ||
} | ||
@media only screen and (max-width: 599px) { | ||
table[class='body-table'] { | ||
width: 100%; | ||
} | ||
img { | ||
max-width: 100%; | ||
height: auto !important; | ||
} | ||
} | ||
@media only screen and (max-width: 510px) { | ||
table[class='inside-table'] { | ||
width: 100%; | ||
padding: 0 10px 0 10px !important; | ||
} | ||
table[class='quote-table'] { | ||
width: 100%; | ||
} | ||
table[class='quote-image-table'] { | ||
width: 100%; | ||
} | ||
} | ||
</style> | ||
</head> | ||
|
||
<body | ||
style=' | ||
background-color: #f1f0f0; | ||
padding: 0; | ||
margin: 0; | ||
font-family: Arial, Helvetica Neue, Helvetica, sans-serif; | ||
font-size: 17px; | ||
color: #342f2e; | ||
' | ||
> | ||
<!--[if gte mso 15]><table border='0' cellpadding='0' cellspacing='0' width='100%' align='left'><tr><td><![endif]--> | ||
<table | ||
align='center' | ||
border='0' | ||
cellpadding='0' | ||
cellspacing='0' | ||
class='body-table' | ||
style='border: 1px solid #d8d6d6; background-color: #ffffff' | ||
width='600' | ||
> | ||
<!-- header --> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<table | ||
border='0' | ||
cellpadding='0' | ||
cellspacing='0' | ||
style='margin-bottom: 40px' | ||
width='100%' | ||
> | ||
<tbody> | ||
<tr> | ||
<td | ||
align='center' | ||
height='110' | ||
style='background-color: #4e2a84; padding: 0 10px 0 10px' | ||
valign='middle' | ||
> | ||
<h1> | ||
<img src="https://nul-public.s3.amazonaws.com/work-archiver/northwestern_logo.png" alt="Northwestern University Logo" /> | ||
</h1> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td | ||
align='center' | ||
height='40' | ||
style=' | ||
background-color: #401f68; | ||
font-size: 13px; | ||
color: #ffffff; | ||
font-style: italic; | ||
' | ||
valign='middle' | ||
></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<table | ||
align='center' | ||
border='0' | ||
cellpadding='0' | ||
cellspacing='0' | ||
class='inside-table' | ||
style='margin-bottom: 40px; padding: 0 66px 0 66px' | ||
width='100%' | ||
> | ||
<tbody> | ||
<tr> | ||
<td style='padding-bottom: 5px'> | ||
<h2 | ||
style=' | ||
margin: 12px 0; | ||
font-size: 32px; | ||
line-height: 1.2em; | ||
' | ||
> | ||
Hello, | ||
</h2> | ||
<p> | ||
Your request for a zipped archive of the work <a href="{{referer}}work/{{workId}}">{{title}}</a> (accession: {{accession}}) has been | ||
fulfilled. Click below to download your zip file: | ||
</p> | ||
<p style='text-align: center'> | ||
<a href='{{downloadKey}}'> | ||
<!-- icon licensed under Creative Commons (Attribution 3.0 Unported): https://www.iconfinder.com/icons/285629/zip_file_icon --> | ||
<img src="https://nul-public.s3.amazonaws.com/work-archiver/email_zip_icon.png" alt="{{downloadKey}}" /> | ||
</a> | ||
</p> | ||
<p style='text-align: center; font-style: italic'> | ||
(Your download will be available for 24 hours) | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
<!-- footer --> | ||
<tr> | ||
<td> | ||
<table | ||
align='center' | ||
border='0' | ||
cellpadding='0' | ||
cellspacing='0' | ||
style='background-color: #4e2a84; padding: 20px 0 20px 0' | ||
width='100%' | ||
> | ||
<tbody> | ||
<tr> | ||
<td align='center' style='padding-bottom: 10px'> | ||
<p> | ||
<a href='https://www.library.northwestern.edu' | ||
><img | ||
alt='Northwestern University Library' | ||
src='https://nul-public.s3.amazonaws.com/work-archiver/northwestern-university.png' | ||
/></a> | ||
</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align='center' style='padding-bottom: 20px'> | ||
<p style='font-size: 12px; font-weight: bold; margin: 0'> | ||
<a | ||
href='https://meadow.library.northwestern.edu' | ||
style='color: #ffffff' | ||
>VISIT MEADOW NOW</a | ||
> | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<!--[if gte mso 15]></td></tr></table><![endif]--> | ||
</body> | ||
</html> |
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,4 @@ | ||
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}} |
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
File renamed without changes.
File renamed without changes.
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,68 @@ | ||
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 || "[email protected]"; | ||
const senderAddress = event.sender; | ||
const downloadLink = event.downloadLink; | ||
const today = new Date().toLocaleDateString("en-us", { | ||
weekday: "long", | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric", | ||
}); | ||
const params = { | ||
email: toAddress, | ||
downloadKey: downloadLink, | ||
referer: "Meadow", | ||
workId: "foo", | ||
today, | ||
title: "[Untitled]", | ||
accession: "1234", | ||
}; | ||
|
||
const sendTemplatedEmailCommand = createSendTemplatedEmailCommand( | ||
toAddress, | ||
senderAddress, | ||
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} | ||
}; | ||
|
||
/** | ||
* | ||
* @param { { emailAddress: string, firstName: string } } user | ||
* @param { string } templateName - The name of an existing template in Amazon SES. | ||
* @returns { SendTemplatedEmailCommand } | ||
*/ | ||
const createSendTemplatedEmailCommand = ( | ||
toAddress, | ||
senderAddress, | ||
templateName, | ||
params | ||
) => { | ||
return new SendTemplatedEmailCommand({ | ||
/** | ||
* Here's an example of how a template would be replaced with user data: | ||
* Template: <h1>Hello {{contact.firstName}},</h1><p>Don't forget about the party gifts!</p> | ||
* Destination: <h1>Hello Bilbo,</h1><p>Don't forget about the party gifts!</p> | ||
*/ | ||
Destination: { ToAddresses: [toAddress] }, | ||
TemplateData: JSON.stringify(params), | ||
Source: `Northwestern University Libraries <${senderAddress}>`, | ||
Template: templateName, | ||
}); | ||
}; |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.