mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #198 from sharelatex/ho-mandrill
add mandrill as email option
This commit is contained in:
commit
d92405c3b5
3 changed files with 366 additions and 453 deletions
|
@ -4,6 +4,7 @@ Settings = require('settings-sharelatex')
|
|||
nodemailer = require("nodemailer")
|
||||
sesTransport = require('nodemailer-ses-transport')
|
||||
sgTransport = require('nodemailer-sendgrid-transport')
|
||||
mandrillTransport = require('nodemailer-mandrill-transport')
|
||||
rateLimiter = require('../../infrastructure/RateLimiter')
|
||||
_ = require("underscore")
|
||||
|
||||
|
@ -17,22 +18,22 @@ client =
|
|||
sendMail: (options, callback = (err,status) ->) ->
|
||||
logger.log options:options, "Would send email if enabled."
|
||||
callback()
|
||||
|
||||
if Settings?.email?.parameters?.AWSAccessKeyID? or Settings?.email?.driver == 'ses'
|
||||
logger.log "using aws ses for email"
|
||||
nm_client = nodemailer.createTransport(sesTransport(Settings.email.parameters))
|
||||
else if Settings?.email?.parameters?.sendgridApiKey?
|
||||
logger.log "using sendgrid for email"
|
||||
nm_client = nodemailer.createTransport(sgTransport({auth:{api_key:Settings?.email?.parameters?.sendgridApiKey}}))
|
||||
else if Settings?.email.parameters.MandrillApiKey?
|
||||
logger.log "using mandril for email"
|
||||
nm_client = nodemailer.createTransport(mandrillTransport({auth:{apiKey:Settings?.email.parameters.MandrillApiKey}}))
|
||||
else if Settings?.email?.parameters?
|
||||
smtp = _.pick(Settings?.email?.parameters, "host", "port", "secure", "auth", "ignoreTLS")
|
||||
|
||||
|
||||
logger.log "using smtp for email"
|
||||
smtp = _.pick(Settings?.email?.parameters, "host", "port", "secure", "auth", "ignoreTLS")
|
||||
nm_client = nodemailer.createTransport(smtp)
|
||||
else
|
||||
nm_client = client
|
||||
logger.warn "Email transport and/or parameters not defined. No emails will be sent."
|
||||
nm_client = client
|
||||
|
||||
if nm_client?
|
||||
client = nm_client
|
||||
|
|
807
services/web/npm-shrinkwrap.json
generated
807
services/web/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
|
@ -56,6 +56,7 @@
|
|||
"multer": "^0.1.8",
|
||||
"node-html-encoder": "0.0.2",
|
||||
"nodemailer": "2.1.0",
|
||||
"nodemailer-mandrill-transport": "^1.2.0",
|
||||
"nodemailer-sendgrid-transport": "^0.2.0",
|
||||
"nodemailer-ses-transport": "^1.3.0",
|
||||
"optimist": "0.6.1",
|
||||
|
|
Loading…
Reference in a new issue