Skip to content

Instantly share code, notes, and snippets.

@PavlikPolivka
Created July 10, 2022 18:33
Show Gist options
  • Save PavlikPolivka/8a3c6b47a632f016d11821c809c868b7 to your computer and use it in GitHub Desktop.
Save PavlikPolivka/8a3c6b47a632f016d11821c809c868b7 to your computer and use it in GitHub Desktop.
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