2014-03-05 11:22:52 +00:00
|
|
|
settings = require("settings-sharelatex")
|
|
|
|
EmailBuilder = require "./EmailBuilder"
|
2014-03-04 18:10:06 +00:00
|
|
|
EmailSender = require "./EmailSender"
|
|
|
|
|
2014-03-06 09:51:19 +00:00
|
|
|
if !settings.email?
|
|
|
|
settings.email =
|
|
|
|
lifecycleEnabled:false
|
|
|
|
|
|
|
|
|
2014-03-04 18:10:06 +00:00
|
|
|
module.exports =
|
|
|
|
|
2014-03-05 14:56:52 +00:00
|
|
|
sendEmail : (emailType, opts, callback = (err)->)->
|
2014-03-05 11:22:52 +00:00
|
|
|
email = EmailBuilder.buildEmail emailType, opts
|
|
|
|
if email.type == "lifecycle" and !settings.email.lifecycle
|
|
|
|
return callback()
|
2014-03-04 18:10:06 +00:00
|
|
|
opts.html = email.html
|
|
|
|
opts.subject = email.subject
|
|
|
|
EmailSender.sendEmail opts, (err)->
|
2014-03-05 11:22:52 +00:00
|
|
|
callback(err)
|