Ejemplo n.º 1
0
def notify_topic_subscribers(post):
    from djangobb_forum.models import Post

    topic = post.topic
    post_body_text = strip_tags(post.body_html)
    if post != topic.head:
        for user in topic.subscribers.all():
            if user != post.user:
                subject = u'RE: %s' % topic.name
                to_email = user.email
                text_content = TOPIC_SUBSCRIPTION_TEXT_TEMPLATE % {
                    'username':
                    post.user.username,
                    'message':
                    post_body_text,
                    'post_url':
                    absolute_url(post.get_absolute_url()),
                    'unsubscribe_url':
                    absolute_url(
                        reverse('djangobb:forum_delete_subscription',
                                args=[post.topic.id])),
                }
                #html_content = html_version(post)
                send_mail(subject, text_content, settings.DEFAULT_FROM_EMAIL,
                          [to_email])
Ejemplo n.º 2
0
def notify_topic_subscribers(post):
    topic = post.topic
    post_body_text = strip_tags(post.body_html)
    if post != topic.head:
        for user in topic.subscribers.all():
            if user != post.user:
                subject = u'RE: %s' % topic.name
                to_email = user.email
                text_content = TOPIC_SUBSCRIPTION_TEXT_TEMPLATE % {
                        'username': post.user.username,
                        'message': post_body_text,
                        'post_url': absolute_url(post.get_absolute_url()),
                        'unsubscribe_url': absolute_url(reverse('djangobb_forum_delete_subscription', args=[post.topic.id])),
                    }
                #html_content = html_version(post)
                send_mail(subject, text_content, settings.DEFAULT_FROM_EMAIL, [to_email])
Ejemplo n.º 3
0
def email_topic_subscribers(post):
    """
    This is the built-in djangobb_forum method of notifying for subscriptions.
    """
    topic = post.topic
    post_body_text = strip_tags(post.body_html)
    if post != topic.head:
        subject = u"RE: %s" % topic.name
        to_email = user.email
        text_content = TOPIC_SUBSCRIPTION_TEXT_TEMPLATE % {
            "username": post.user.username,
            "message": post_body_text,
            "post_url": absolute_url(post.get_absolute_url()),
            "unsubscribe_url": absolute_url(reverse("djangobb:forum_delete_subscription", args=[post.topic.id])),
        }
        # html_content = html_version(post)
        send_mail(subject, text_content, settings.DEFAULT_FROM_EMAIL, [to_email])
Ejemplo n.º 4
0
def email_topic_subscribers(post):
    """
    This is the built-in djangobb_forum method of notifying for subscriptions.
    """
    topic = post.topic
    post_body_text = strip_tags(post.body_html)
    if post != topic.head:
        subject = u'RE: %s' % topic.name
        to_email = user.email
        text_content = TOPIC_SUBSCRIPTION_TEXT_TEMPLATE % {
            'username':
            post.user.username,
            'message':
            post_body_text,
            'post_url':
            absolute_url(post.get_absolute_url()),
            'unsubscribe_url':
            absolute_url(
                reverse('djangobb:forum_delete_subscription',
                        args=[post.topic.id])),
        }
        #html_content = html_version(post)
        send_mail(subject, text_content, settings.DEFAULT_FROM_EMAIL,
                  [to_email])