Skip to content

Commit

Permalink
feat: Update email sending function to use MailerSend API
Browse files Browse the repository at this point in the history
  • Loading branch information
niyobern committed May 3, 2024
1 parent ea1a55b commit 29c862c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/emails/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ async function sendEmail(emailType: EmailType, recipient: string, data: Data) {

// Send the Email

const domain2 = process.env.MAILERSEND_DOMAIN
const key2 = process.env.MAILERSEND_TOKEN
const body2 = {
const domain = process.env.MAILERSEND_DOMAIN
const key = process.env.MAILERSEND_TOKEN
const body = {
'from': {
'email': `info@${domain2}`,
'email': `info@${domain}`,
},
'to': [
{
Expand All @@ -46,10 +46,10 @@ async function sendEmail(emailType: EmailType, recipient: string, data: Data) {
'html': html
}
const mailersend = 'https://api.mailersend.com/v1/email'
const response = await axios.post(mailersend, body2, {
const response = await axios.post(mailersend, body, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${key2}`
'Authorization': `Bearer ${key}`
}
});
return response
Expand Down

0 comments on commit 29c862c

Please sign in to comment.