Ejemplo n.º 1
0
def send_error_email(group_name, error, user_addr, admin_emails):
    mail = MurmurMailResponse(From=NO_REPLY, Subject="Error")
    mail.Body = "You tried to post to: %s. Error Message: %s" % (group_name,
                                                                 error)
    if user_addr:
        mail.Body = "You tried to post to: %s. Error Message: %s" % (
            group_name, error)
        relay.deliver(mail, To=user_addr)
    if admin_emails:
        mail.Body = "User %s tried to post to: %s. Error Message: %s" % (
            user_addr, group_name, error)
        relay.deliver(mail, To=ADMIN_EMAILS)
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
def send_error_email(group_name, error, user_addr, admin_emails):
	mail = MurmurMailResponse(From = NO_REPLY, Subject = "Error")
	mail.Body = "You tried to post to: %s. Error Message: %s" % (group_name, error)
	if user_addr:
		relay.deliver(mail, To = user_addr)
	if admin_emails:
		relay.deliver(mail, To = ADMIN_EMAILS)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)