Permalink
Browse files

Mailer: log email content to console when in test mode

  • Loading branch information...
hnrch02 committed Jan 2, 2019
1 parent 71dad1c commit 588a5a9fef9a67cb91615fc7ef43c6b9b6b70134
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/mailer.js
@@ -16,12 +16,13 @@ Mailer.prototype.render = function(name, context) {
}

Mailer.prototype.send = function(options, context) {
if(!options.template || !options.to || !options.from || !options.subject) {
if(!options.template || !options.to || !options.from || !options.subject) {
return Promise.reject(new Error('Missing options. template|from|to|subject required.'))
}

return this.render(options.template, context)
.then(function(renders) {
if (config.mail.mailgun.testMode) console.log(renders.text || renders.html)
return mailgun.messages().send({
from: options.from,
subject: options.subject,

0 comments on commit 588a5a9

Please sign in to comment.