added sendgrid as email option

This commit is contained in:
Henry Oswald 2016-03-29 14:15:33 +01:00
parent e2dffdf722
commit 1a651b38f4
2 changed files with 6 additions and 0 deletions

View file

@ -3,6 +3,8 @@ metrics = require('../../infrastructure/Metrics')
Settings = require('settings-sharelatex')
nodemailer = require("nodemailer")
sesTransport = require('nodemailer-ses-transport')
sgTransport = require('nodemailer-sendgrid-transport')
_ = require("underscore")
if Settings.email? and Settings.email.fromAddress?
@ -19,6 +21,9 @@ client =
if Settings?.email?.parameters?.AWSAccessKeyID?
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?
smtp = _.pick(Settings?.email?.parameters, "host", "port", "secure", "auth")

View file

@ -39,6 +39,7 @@
"multer": "^0.1.8",
"node-uuid": "1.4.1",
"nodemailer": "2.1.0",
"nodemailer-sendgrid-transport": "^0.2.0",
"nodemailer-ses-transport": "^1.3.0",
"optimist": "0.6.1",
"redback": "0.4.0",