Send teacher contact form inquires to schools support email

This commit is contained in:
Matt Lott 2016-05-12 13:22:25 -07:00
parent 84d6ae5fe2
commit a062e49c50
2 changed files with 8 additions and 2 deletions

View file

@ -27,19 +27,24 @@ createMailContext = (req, done) ->
level = if user?.get('points') > 0 then Math.floor(5 * Math.log((1 / 100) * (user.get('points') + 100))) + 1 else 0
premium = user?.isPremium()
teacher = user?.isTeacher()
content = """
#{message}
--
<a href='http://codecombat.com/user/#{user.get('slug') or user.get('_id')}'>#{user.get('name') or 'Anonymous'}</a> - Level #{level}#{if premium then ' - Subscriber' else ''}#{if country then ' - ' + country else ''}
<a href='http://codecombat.com/user/#{user.get('slug') or user.get('_id')}'>#{user.get('name') or 'Anonymous'}</a> - Level #{level}#{if teacher then ' - Teacher' else ''}#{if premium then ' - Subscriber' else ''}#{if country then ' - ' + country else ''}
"""
if req.body.browser
content += "\n#{req.body.browser} - #{req.body.screenSize}"
address = switch
when teacher then config.mail.supportSchools
when premium then config.mail.supportPremium
else config.mail.supportPrimary
context =
email_id: sendwithus.templates.plain_text_email
recipient:
address: if premium then config.mail.supportPremium else config.mail.supportPrimary
address: address
sender:
address: config.mail.username
reply_to: sender or user.get('email')

View file

@ -55,6 +55,7 @@ config.mail =
username: process.env.COCO_MAIL_SERVICE_USERNAME or ''
supportPrimary: process.env.COCO_MAIL_SUPPORT_PRIMARY or ''
supportPremium: process.env.COCO_MAIL_SUPPORT_PREMIUM or ''
supportSchools: process.env.COCO_MAIL_SUPPORT_SCHOOLS or ''
mailchimpAPIKey: process.env.COCO_MAILCHIMP_API_KEY or ''
mailchimpWebhook: process.env.COCO_MAILCHIMP_WEBHOOK or '/mail/webhook'
sendwithusAPIKey: process.env.COCO_SENDWITHUS_API_KEY or ''