-
-
Save DPLATA/057433835117401d4c57e96c9b402cc8 to your computer and use it in GitHub Desktop.
netlify functions: sendEmail
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
POSTMARK_API_KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
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
[build] | |
functions = "functions" | |
[[plugins]] | |
package = "@netlify/plugin-emails" |
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
const { POSTMARK_API_KEY } = process.env | |
const serverToken = POSTMARK_API_KEY | |
let postmark = require("postmark") | |
let client = new postmark.ServerClient(serverToken); | |
exports.handler = (event, context, callback) => { | |
client.sendEmail( | |
{ | |
From: "yourname@youremail.com", | |
To: "recipient@anotheremail.com", | |
Subject: "test email", | |
HtmlBody: "test", | |
TextBody: "test" | |
} | |
) | |
callback(null, { | |
statusCode: 200, | |
body: 'I am on my way !' | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment