feat: mock-email and some fixes for email auth

This commit is contained in:
Rafael Taranto 2023-11-28 19:01:35 +00:00
parent ab304093f3
commit c173f241eb
10 changed files with 97 additions and 26 deletions

View file

@ -16,7 +16,22 @@ function sendMessage ({apiKey, domain, fromEmail, toEmail}, rec) {
return mailgun.messages().send(emailData)
}
function sendCustomerMessage ({apiKey, domain, fromEmail}, rec) {
const mailgun = Mailgun({apiKey, domain})
const to = req.email.toEmail
const emailData = {
from: fromEmail,
to,
subject: rec.email.subject,
text: rec.email.body
}
return mailgun.messages().send(emailData)
}
module.exports = {
NAME,
sendMessage
sendMessage,
sendCustomerMessage
}