Created
July 10, 2022 18:33
-
-
Save PavlikPolivka/8a3c6b47a632f016d11821c809c868b7 to your computer and use it in GitHub Desktop.
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 sendInBlueKey = process.env.NEXT_PUBLIC_SEND_IN_BLUE_KEY | |
export default async function handler(req, res) { | |
const body = req.body | |
const resp = await fetch('https://api.sendinblue.com/v3/smtp/email', { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json', | |
'api-key': sendInBlueKey | |
}, | |
body: JSON.stringify({ | |
"sender":{ | |
"name": body.name, | |
"email": body.email | |
}, | |
"to":[ | |
{ | |
"email": "myemail@ppolivka.com", | |
"name": "Pavel Polivka" | |
} | |
], | |
"subject":`Contact Form Eamil From ${body.name}`, | |
"htmlContent":` | |
<html> | |
<head></head> | |
<body> | |
From: ${body.name} <br/> | |
Message: ${body.message} <br/> | |
</body> | |
</html> | |
` | |
}) | |
}); | |
res.status(200).end() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment