Replace mailjet with mailgun (#180)
This commit is contained in:
parent
6a2e3bc348
commit
3b14a715b4
7 changed files with 245 additions and 36 deletions
21
lib/plugins/email/mailgun/mailgun.js
Normal file
21
lib/plugins/email/mailgun/mailgun.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
const Mailgun = require('mailgun-js')
|
||||
|
||||
const NAME = 'Mailgun'
|
||||
|
||||
function sendMessage ({apiKey, domain, fromEmail, toEmail}, rec) {
|
||||
const mailgun = Mailgun({apiKey, domain})
|
||||
|
||||
const emailData = {
|
||||
from: `Lamassu Server ${fromEmail}`,
|
||||
to: toEmail,
|
||||
subject: rec.email.subject,
|
||||
text: rec.email.body
|
||||
}
|
||||
|
||||
return mailgun.messages().send(emailData)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue