def setup_moderation_post(group_name): subject = 'New posts to Squadbox squad %s require approval' % group_name to = '%s Moderators <%s+mods@%s>' % (group_name, group_name, HOST) from_addr = 'Squadbox Notifications <%s+notifications@%s>' % (group_name, HOST) mail = MurmurMailResponse(From=from_addr, To=to, Subject=subject) mail.update({ "Sender" : from_addr, "Reply-To" : from_addr, "List-Id" : from_addr, "Return-Path": from_addr, "Precedence": 'list' }) pending_count = Post.objects.filter(group__name=group_name, status='P').count() body_base = 'As of now, there are %s pending posts. To view all of them, visit the ' % pending_count plain_body = body_base + "moderation queue: %s/mod_queue/%s" % (BASE_URL, group_name) html_body = body_base + "<a href='%s/mod_queue/%s'>moderation queue</a>." % (BASE_URL, group_name) blurb = "You're receiving this message because you're a moderator of the squad %s." % group_name html_ps_blurb = '%s%s%s' % (HTML_SUBHEAD, blurb, HTML_SUBTAIL) plain_ps_blurb = '%s%s%s' % (PLAIN_SUBHEAD, blurb, PLAIN_SUBTAIL) mail.Html = html_body + html_ps_blurb mail.Body = plain_body + plain_ps_blurb return mail
def setup_moderation_post(group_name): subject = 'New posts to Squadbox squad %s require approval' % group_name to = '%s Moderators <%s+mods@%s>' % (group_name, group_name, HOST) from_addr = 'Squadbox Notifications <%s+notifications@%s>' % (group_name, HOST) mail = MurmurMailResponse(From=from_addr, To=to, Subject=subject) mail.update({ "Sender" : from_addr, "Reply-To" : from_addr, "List-Id" : from_addr, "Return-Path": from_addr, "Precedence": 'list' }) pending_count = Post.objects.filter(group__name=group_name, status='P').count() body_base = 'As of now, there are %s pending posts. To view all of them, visit the ' % pending_count plain_body = body_base + "moderation queue: %s/mod_queue/%s" % (BASE_URL, group_name) html_body = body_base + "<a href='%s/mod_queue/%s'>moderation queue</a>." % (BASE_URL, group_name) blurb = "You're receiving this message because you're a moderator of the squad %s." % group_name html_ps_blurb = '%s%s%s' % (HTML_SUBHEAD, blurb, HTML_SUBTAIL) plain_ps_blurb = '%s%s%s' % (PLAIN_SUBHEAD, blurb, PLAIN_SUBTAIL) mail.Html = html_body + html_ps_blurb mail.Body = plain_body + plain_ps_blurb return mail
def send_email(subject, from_addr, to_addr, body_plain=None, body_html=None): mail = MurmurMailResponse(From = from_addr, Subject = subject) if body_plain: mail.Body = body_plain if body_html: mail.Html = body_html relay_mailer.deliver(mail, To = to_addr)
def send_email(subject, from_addr, to_addr, body_plain=None, body_html=None): mail = MurmurMailResponse(From = from_addr, Subject = subject) if body_plain: mail.Body = body_plain if body_html: mail.Html = body_html relay_mailer.deliver(mail, To = to_addr)