overleaf/services/web/app/coffee/Features/Email/EmailHandler.coffee
2014-03-06 09:51:19 +00:00

19 lines
No EOL
500 B
CoffeeScript

settings = require("settings-sharelatex")
EmailBuilder = require "./EmailBuilder"
EmailSender = require "./EmailSender"
if !settings.email?
settings.email =
lifecycleEnabled:false
module.exports =
sendEmail : (emailType, opts, callback = (err)->)->
email = EmailBuilder.buildEmail emailType, opts
if email.type == "lifecycle" and !settings.email.lifecycle
return callback()
opts.html = email.html
opts.subject = email.subject
EmailSender.sendEmail opts, (err)->
callback(err)