diff --git a/r2/r2/lib/emailer.py b/r2/r2/lib/emailer.py index 0689e4dde..fa499445b 100644 --- a/r2/r2/lib/emailer.py +++ b/r2/r2/lib/emailer.py @@ -49,6 +49,12 @@ def _nerds_email(body, from_name, kind): Email.handler.add_to_queue(None, g.nerds_email, from_name, g.nerds_email, kind, body = body) +def _fraud_email(body, kind): + """ + For sending email to the fraud mailbox + """ + Email.handler.add_to_queue(None, g.fraud_email, g.domain, g.fraud_email, + kind, body=body) def verify_email(user, dest=None): """ @@ -257,13 +263,16 @@ def void_payment(thing, campaign, reason): reason=reason) +def fraud_alert(body): + return _fraud_email(body, Email.Kind.FRAUD_ALERT) + def suspicious_payment(user, link): from r2.lib.pages import SuspiciousPaymentEmail - email = "fraud@reddit.com" body = SuspiciousPaymentEmail(user, link).render(style="email") kind = Email.Kind.SUSPICIOUS_PAYMENT - _system_email(email, body, kind) + + return _fraud_email(body, kind) def send_html_email(to_addr, from_addr, subject, html, subtype="html"): diff --git a/r2/r2/models/mail_queue.py b/r2/r2/models/mail_queue.py index a3c65dbf4..d2ee8977d 100644 --- a/r2/r2/models/mail_queue.py +++ b/r2/r2/models/mail_queue.py @@ -307,6 +307,7 @@ class Email(object): "VOID_PAYMENT", "GOLD_GIFT_CODE", "SUSPICIOUS_PAYMENT", + "FRAUD_ALERT", ) # Do not remove anything from this dictionary! See above comment. @@ -333,6 +334,7 @@ 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") } def __init__(self, user, thing, email, from_name, date, ip,