Add community_email method

This commit is contained in:
David Wick
2014-12-03 10:33:32 -08:00
parent 705b49f073
commit 5eca8e81ac
3 changed files with 14 additions and 1 deletions

View File

@@ -272,6 +272,7 @@ class Globals(object):
'feedback_email',
'share_reply',
'nerds_email',
'community_email',
'smtp_server',
],

View File

@@ -56,6 +56,13 @@ def _fraud_email(body, kind):
Email.handler.add_to_queue(None, g.fraud_email, g.domain, g.fraud_email,
kind, body=body)
def _community_email(body, kind):
"""
For sending email to the community mailbox
"""
Email.handler.add_to_queue(c.user, g.community_email, g.domain, g.community_email,
kind, body=body)
def verify_email(user, dest=None):
"""
For verifying an email address
@@ -119,6 +126,9 @@ def email_change_email(user):
EmailChangeEmail(user=user).render(style='email'),
Email.Kind.EMAIL_CHANGE)
def community_email(body, kind):
return _community_email(body, kind)
def nerds_email(body, from_name=g.domain):
"""Queues a feedback email to the nerds running this site."""

View File

@@ -308,6 +308,7 @@ class Email(object):
"GOLD_GIFT_CODE",
"SUSPICIOUS_PAYMENT",
"FRAUD_ALERT",
"USER_FRAUD",
)
# Do not remove anything from this dictionary! See above comment.
@@ -334,7 +335,8 @@ class Email(object):
Kind.VOID_PAYMENT: _("[reddit] your payment has been voided"),
Kind.GOLD_GIFT_CODE: _("[reddit] your reddit gold gift code"),
Kind.SUSPICIOUS_PAYMENT: _("[selfserve] suspicious payment alert"),
Kind.FRAUD_ALERT: _("[selfserve] fraud alert")
Kind.FRAUD_ALERT: _("[selfserve] fraud alert"),
Kind.USER_FRAUD: _("[selfserve] a user has committed fraud"),
}
def __init__(self, user, thing, email, from_name, date, ip,