-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
01b3d6f
commit 211a33a
Showing
4 changed files
with
51 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ static/admin/*.bundle.* | |
.DS_Store | ||
yarn-error.log | ||
# lambda functions | ||
functions | ||
functions | ||
.env |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require('dotenv').config(); | ||
const nodemailer = require('nodemailer'); | ||
|
||
exports.handler = function(event, context, callback) { | ||
const user = process.env.MAIL_USER; | ||
const pass = process.env.MAIL_PASSWORD; | ||
|
||
let transporter = nodemailer.createTransport({ | ||
host: 'smtp.gmail.com', | ||
port: 587, | ||
secure: false, | ||
auth: { user, pass } | ||
}); | ||
|
||
let mailOptions = { | ||
from: `"Maciej 🥝 Smoothielicious" <${user}>`, | ||
to: '[email protected]', | ||
subject: '🍇 Contact submission received!', | ||
text: 'Hello world?', | ||
html: '<b>Hello world?</b>' | ||
}; | ||
|
||
transporter.sendMail(mailOptions, (error, info) => { | ||
if (error) { | ||
return callback(null, { | ||
statusCode: 500, | ||
body: JSON.stringify(error) | ||
}) | ||
} | ||
|
||
// console.log('Mail sent to:', mailOptions.to); | ||
console.log(JSON.stringify({ event, context })); | ||
|
||
callback(null, { | ||
statusCode: 200, | ||
body: 'mail sent' | ||
}) | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -3048,6 +3048,10 @@ dotenv@^4.0.0: | |
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d" | ||
|
||
dotenv@^5.0.1: | ||
version "5.0.1" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef" | ||
|
||
download@^4.0.0, download@^4.1.2: | ||
version "4.4.3" | ||
resolved "https://registry.yarnpkg.com/download/-/download-4.4.3.tgz#aa55fdad392d95d4b68e8c2be03e0c2aa21ba9ac" | ||
|
@@ -7157,6 +7161,10 @@ [email protected]: | |
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/node-version/-/node-version-1.1.0.tgz#f437d7ba407e65e2c4eaef8887b1718ba523d4f0" | ||
|
||
nodemailer@^4.6.4: | ||
version "4.6.4" | ||
resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-4.6.4.tgz#f0d72d0c6a6ec5f4369fa8f4bf5127a31baa2014" | ||
|
||
[email protected]: | ||
version "0.0.0" | ||
resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859" | ||
|