 			return callback()
 		logger.log user:user, email:user.email, "trying to unsubscribe user to the mailing list"
 		options = buildOptions(user, false)
+		mailchimp = new Mailchimp(Settings.mailchimp?.api_key)
 		mailchimp.request options, (err)->
 			if err?
 				logger.err err:err, "error unsubscribing person to newsletter"

Settings = require 'settings-sharelatex'
crypto = require('crypto')
Mailchimp = require('mailchimp-api-v3')
mailchimp = new Mailchimp(Settings.mailchimp?.api_key) if Settings.mailchimp?

module.exports =
	subscribe: (user, callback = () ->)->

			return callback()
		options = buildOptions(user, true)
		logger.log options:options, user:user, email:user.email, "trying to subscribe user to the mailing list"
		mailchimp = new Mailchimp(Settings.mailchimp?.api_key)
		mailchimp.request options, (err)->
			if err?
				logger.err err:err, "error subscribing person to newsletter"
