Python django.conf.settings.EMAIL_SUBJECT_PREFIX Examples

The following are 23 code examples for showing how to use django.conf.settings.EMAIL_SUBJECT_PREFIX(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module django.conf.settings , or try the search function .

Example 1
Project: telemetry-analysis-service   Author: mozilla   File: test_tasks.py    License: Mozilla Public License 2.0 6 votes vote down vote up
def test_send_expiration_mails(mailoutbox, mocker, now, cluster_factory):
    cluster = cluster_factory(
        expires_at=now + timedelta(minutes=59),  # 1 hours is the cut-off
        most_recent_status=models.Cluster.STATUS_WAITING,
    )
    assert len(mailoutbox) == 0
    tasks.send_expiration_mails()
    assert len(mailoutbox) == 1
    message = mailoutbox[0]
    assert message.subject == (
        "%sCluster %s is expiring soon!"
        % (settings.EMAIL_SUBJECT_PREFIX, cluster.identifier)
    )
    assert message.from_email == settings.DEFAULT_FROM_EMAIL
    assert list(message.to) == [cluster.created_by.email]
    cluster.refresh_from_db()
    assert cluster.expiration_mail_sent 
Example 2
Project: Bitpoll   Author: fsinfuhh   File: views.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _send_invitation_mail(request, invitation, subject, template_name):
    if not invitation.invitee.email:
        return
    old_lang = translation.get_language()
    translation.activate(invitation.invitee.language)
    template = loader.get_template('groups/mail_{0}.txt'.format(template_name))
    message = template.render({
        'invitation': invitation,
        'site': get_current_site(request)
    })
    translation.activate(old_lang)
    send_mail(settings.EMAIL_SUBJECT_PREFIX + subject,
              message,
              settings.DEFAULT_FROM_EMAIL,
              [invitation.invitee.email],
              fail_silently=True) 
Example 3
Project: diting   Author: getway   File: tasks.py    License: GNU General Public License v2.0 6 votes vote down vote up
def send_mail_async(*args, **kwargs):
    """ Using celery to send email async

    You can use it as django send_mail function

    Example:
    send_mail_sync.delay(subject, message, from_mail, recipient_list, fail_silently=False, html_message=None)

    Also you can ignore the from_mail, unlike django send_mail, from_email is not a require args:

    Example:
    send_mail_sync.delay(subject, message, recipient_list, fail_silently=False, html_message=None)
    """
    if len(args) == 3:
        args = list(args)
        args[0] = settings.EMAIL_SUBJECT_PREFIX + args[0]
        args.insert(2, settings.EMAIL_HOST_USER)
        args = tuple(args)

    try:
        send_mail(*args, **kwargs)
    except Exception as e:
        logger.error("Sending mail error: {}".format(e)) 
Example 4
Project: Kiwi   Author: kiwitcms   File: test_models.py    License: GNU General Public License v2.0 6 votes vote down vote up
def test_send_mail_to_case_author(self, send_mail):
        expected_subject = _('DELETED: TestCase #%(pk)d - %(summary)s') % {
            'pk': self.case.pk,
            'summary': self.case.summary
        }
        expected_body = render_to_string('email/post_case_delete/email.txt', {'case': self.case})
        recipients = get_case_notification_recipients(self.case)

        self.case.delete()

        # Verify notification mail
        send_mail.assert_called_once_with(settings.EMAIL_SUBJECT_PREFIX + expected_subject,
                                          expected_body,
                                          settings.DEFAULT_FROM_EMAIL,
                                          recipients,
                                          fail_silently=False) 
Example 5
Project: Kiwi   Author: kiwitcms   File: test_models.py    License: GNU General Public License v2.0 6 votes vote down vote up
def test_notify_assignee_on_bug_creation(self, send_mail):
        assignee = UserFactory()
        bug = BugFactory(assignee=assignee)

        expected_subject = _('NEW: Bug #%(pk)d - %(summary)s') % {'pk': bug.pk,
                                                                  'summary': bug.summary}
        expected_body = render_to_string('email/post_bug_save/email.txt', {'bug': bug})
        expected_recipients = [assignee.email]

        send_mail.assert_called_once_with(
            settings.EMAIL_SUBJECT_PREFIX + expected_subject,
            expected_body,
            settings.DEFAULT_FROM_EMAIL,
            expected_recipients,
            fail_silently=False
        )
        self.assertTrue(send_mail.called) 
Example 6
Project: yats   Author: mediafactory   File: shortcuts.py    License: MIT License 6 votes vote down vote up
def mail_comment(request, comment_id):
    from yats.models import tickets_comments
    com = tickets_comments.objects.get(pk=comment_id)
    ticket_id = com.ticket_id
    int_rcpt, pub_rcpt = get_mail_recipient_list(request, ticket_id)

    tic = get_ticket_model().objects.get(pk=ticket_id)

    if len(int_rcpt) > 0:
        try:
            send_mail('%s#%s: %s - %s' % (settings.EMAIL_SUBJECT_PREFIX, tic.id, _('new comment'), tic.caption), '%s\n\n%s' % (com.comment, get_ticket_url(request, ticket_id)), settings.SERVER_EMAIL, int_rcpt, False)
        except Exception:
            messages.add_message(request, messages.ERROR, _('mail not send: %s') % sys.exc_info()[1])

    if len(pub_rcpt) > 0:
        try:
            send_mail('%s#%s: %s - %s' % (settings.EMAIL_SUBJECT_PREFIX, tic.id, _('new comment'), tic.caption), '%s\n\n%s' % (com.comment, get_ticket_url(request, ticket_id, for_customer=True)), settings.SERVER_EMAIL, pub_rcpt, False)
        except Exception:
            messages.add_message(request, messages.ERROR, _('mail not send: %s') % sys.exc_info()[1]) 
Example 7
Project: GTDWeb   Author: lanbing510   File: __init__.py    License: GNU General Public License v2.0 5 votes vote down vote up
def mail_admins(subject, message, fail_silently=False, connection=None,
                html_message=None):
    """Sends a message to the admins, as defined by the ADMINS setting."""
    if not settings.ADMINS:
        return
    mail = EmailMultiAlternatives('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject),
                message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
                connection=connection)
    if html_message:
        mail.attach_alternative(html_message, 'text/html')
    mail.send(fail_silently=fail_silently) 
Example 8
Project: GTDWeb   Author: lanbing510   File: __init__.py    License: GNU General Public License v2.0 5 votes vote down vote up
def mail_managers(subject, message, fail_silently=False, connection=None,
                  html_message=None):
    """Sends a message to the managers, as defined by the MANAGERS setting."""
    if not settings.MANAGERS:
        return
    mail = EmailMultiAlternatives('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject),
                message, settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS],
                connection=connection)
    if html_message:
        mail.attach_alternative(html_message, 'text/html')
    mail.send(fail_silently=fail_silently) 
Example 9
Project: telemetry-analysis-service   Author: mozilla   File: test_tasks.py    License: Mozilla Public License 2.0 5 votes vote down vote up
def test_extended_cluster_resends_expiration_mail(mailoutbox, mocker, one_hour_ago, cluster_factory):
    cluster = cluster_factory(
        expires_at=one_hour_ago,
        most_recent_status=models.Cluster.STATUS_WAITING,
    )

    # Send first expiration email
    assert len(mailoutbox) == 0
    tasks.send_expiration_mails()
    assert len(mailoutbox) == 1
    message = mailoutbox[0]
    assert message.subject == (
        '%sCluster %s is expiring soon!' %
        (settings.EMAIL_SUBJECT_PREFIX, cluster.identifier)
    )
    assert message.from_email == settings.DEFAULT_FROM_EMAIL
    assert list(message.to) == [cluster.created_by.email]
    cluster.refresh_from_db()
    assert cluster.expiration_mail_sent

    # Extend cluster lifetime
    cluster.extend(1)
    cluster.refresh_from_db()
    assert cluster.expiration_mail_sent is False

    # Send second expiration email
    tasks.send_expiration_mails()
    assert len(mailoutbox) == 2
    message = mailoutbox[1]
    assert message.subject == (
        '%sCluster %s is expiring soon!' %
        (settings.EMAIL_SUBJECT_PREFIX, cluster.identifier)
    )
    assert message.from_email == settings.DEFAULT_FROM_EMAIL
    assert list(message.to) == [cluster.created_by.email]
    cluster.refresh_from_db()
    assert cluster.expiration_mail_sent 
Example 10
Project: telemetry-analysis-service   Author: mozilla   File: test_tasks.py    License: Mozilla Public License 2.0 5 votes vote down vote up
def test_send_run_alert_mails(
    client, mailoutbox, mocker, spark_job, sparkjob_provisioner_mocks
):
    mocker.patch(
        "atmo.clusters.provisioners.ClusterProvisioner.info",
        return_value={
            "creation_datetime": timezone.now(),
            "ready_datetime": None,
            "end_datetime": None,
            "state": Cluster.STATUS_TERMINATED_WITH_ERRORS,
            "state_change_reason_code": Cluster.STATE_CHANGE_REASON_BOOTSTRAP_FAILURE,
            "state_change_reason_message": "Bootstrapping steps failed.",
            "public_dns": None,
        },
    )
    spark_job.run()
    assert spark_job.latest_run.alerts.exists()
    assert len(mailoutbox) == 0
    tasks.send_run_alert_mails()
    assert len(mailoutbox) == 1
    message = mailoutbox[0]
    assert message.subject == (
        "%sRunning Spark job %s failed"
        % (settings.EMAIL_SUBJECT_PREFIX, spark_job.identifier)
    )

    assert message.from_email == settings.DEFAULT_FROM_EMAIL
    assert list(message.cc) == [settings.DEFAULT_FROM_EMAIL]
    assert list(message.to) == [spark_job.created_by.email] 
Example 11
Project: telemetry-analysis-service   Author: mozilla   File: test_tasks.py    License: Mozilla Public License 2.0 5 votes vote down vote up
def test_send_expired_mails(mailoutbox, mocker, now, spark_job):
    spark_job.expired_date = now
    spark_job.save()
    assert len(mailoutbox) == 0
    tasks.send_expired_mails()
    assert len(mailoutbox) == 1
    message = mailoutbox[0]
    assert message.subject == (
        "%sSpark job %s expired" % (settings.EMAIL_SUBJECT_PREFIX, spark_job.identifier)
    )
    assert message.from_email == settings.DEFAULT_FROM_EMAIL
    assert list(message.cc) == [settings.DEFAULT_FROM_EMAIL]
    assert list(message.to) == [spark_job.created_by.email]
    spark_job.refresh_from_db() 
Example 12
Project: pasportaservo   Author: tejoesperanto   File: views.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def get(self, request, *args, **kwargs):
        if request.user.is_authenticated:
            # Only anonymous (non-authenticated) users are expected to access this page.
            return HttpResponseRedirect(self.get_authenticated_redirect_url())
        request_id = request.session.pop('restore_request_id', None)
        if request_id is None or not isinstance(request_id[1], float):
            # When the restore request ID is missing or invalid, just show the login page.
            return HttpResponseRedirect(reverse_lazy('login'))
        if datetime.now() - datetime.fromtimestamp(request_id[1]) > timedelta(hours=1):
            # When the restore request ID is expired (older than 1 hour), redirect to the login page.
            # This is to prevent abuse, when the user leaves their browser or device open and
            # a different person attempts to (mis)use the restoration request functionality...
            messages.warning(self.request, _("Something misfunctioned. Please log in again and retry."))
            return HttpResponseRedirect(reverse_lazy('login'))
        # Otherwise, send mail to admins.
        send_mail(
            '{prefix}{subject}'.format(
                prefix=settings.EMAIL_SUBJECT_PREFIX,
                subject=gettext(
                    # xgettext:python-brace-format
                    "Note to admin: User requests to reactivate their account; ref: {}."
                ).format(request_id[0])),
            "--",
            None,
            ['{} <{}>'.format(nick, addr) for nick, addr in settings.ADMINS],
            fail_silently=False)
        context = self.get_context_data(**kwargs)
        return self.render_to_response(context) 
Example 13
Project: opencraft   Author: open-craft   File: utilities.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def _mail_admins_with_attachment(
            subject,
            message,
            fail_silently=True,
            connection=None,
            html_message=None,
            attachments=None,
            extra_recipients: Optional[List[str]] = None,
    ):
        """
        Mimics mail_admins, but allows attaching files to the message
        """
        if not settings.ADMINS and not extra_recipients:
            return

        recipients = [a[1] for a in settings.ADMINS] + extra_recipients
        mail = EmailMultiAlternatives(
            "%s%s" % (settings.EMAIL_SUBJECT_PREFIX, subject),
            message, settings.SERVER_EMAIL, recipients,
            connection=connection
        )

        if html_message:
            mail.attach_alternative(html_message, "text/html")

        if attachments:
            for attachment_name, attachment_content, attachment_mime in attachments:
                mail.attach(attachment_name, attachment_content, attachment_mime)

        mail.send(fail_silently=fail_silently)


# Functions ##################################################################### 
Example 14
Project: luscan-devel   Author: blackye   File: __init__.py    License: GNU General Public License v2.0 5 votes vote down vote up
def mail_admins(subject, message, fail_silently=False, connection=None,
                html_message=None):
    """Sends a message to the admins, as defined by the ADMINS setting."""
    if not settings.ADMINS:
        return
    mail = EmailMultiAlternatives('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject),
                message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
                connection=connection)
    if html_message:
        mail.attach_alternative(html_message, 'text/html')
    mail.send(fail_silently=fail_silently) 
Example 15
Project: luscan-devel   Author: blackye   File: __init__.py    License: GNU General Public License v2.0 5 votes vote down vote up
def mail_managers(subject, message, fail_silently=False, connection=None,
                  html_message=None):
    """Sends a message to the managers, as defined by the MANAGERS setting."""
    if not settings.MANAGERS:
        return
    mail = EmailMultiAlternatives('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject),
                message, settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS],
                connection=connection)
    if html_message:
        mail.attach_alternative(html_message, 'text/html')
    mail.send(fail_silently=fail_silently) 
Example 16
Project: Kiwi   Author: kiwitcms   File: test_models.py    License: GNU General Public License v2.0 5 votes vote down vote up
def test_send_mail_to_case_author(self, send_mail):
        self.case.summary = 'New summary for running test'
        self.case.save()

        expected_subject, expected_body = history_email_for(self.case, self.case.summary)
        recipients = get_case_notification_recipients(self.case)

        # Verify notification mail
        send_mail.assert_called_once_with(settings.EMAIL_SUBJECT_PREFIX + expected_subject,
                                          expected_body,
                                          settings.DEFAULT_FROM_EMAIL,
                                          recipients,
                                          fail_silently=False) 
Example 17
Project: Kiwi   Author: kiwitcms   File: tests.py    License: GNU General Public License v2.0 5 votes vote down vote up
def test_register_user_by_email_confirmation(self, send_mail):
        response, user = self.assert_user_registration('new-tester', follow=True)
        self.assertContains(
            response,
            _('Your account has been created, please check your mailbox for confirmation')
        )

        site = Site.objects.get(pk=settings.SITE_ID)
        confirm_url = 'http://%s%s' % (site.domain, reverse('tcms-confirm',
                                                            args=[self.fake_activate_key]))

        # Verify notification mail
        values = {
            'user': user.username,
            'site_domain': site.domain,
            'confirm_url': confirm_url,
        }
        expected_subject = settings.EMAIL_SUBJECT_PREFIX + \
            _('Your new %s account confirmation') % site.domain
        expected_body = _("""Welcome %(user)s,
thank you for signing up for an %(site_domain)s account!

To activate your account, click this link:
%(confirm_url)s""") % values + "\n"
        send_mail.assert_called_once_with(expected_subject, expected_body,
                                          settings.DEFAULT_FROM_EMAIL,
                                          ['new-tester@example.com'],
                                          fail_silently=False) 
Example 18
Project: Kiwi   Author: kiwitcms   File: mailto.py    License: GNU General Public License v2.0 5 votes vote down vote up
def mailto(template_name, subject, recipients=None,  # pylint: disable=invalid-name
           context=None, cc=None):

    # make a list with recipients and filter out duplicates
    if isinstance(recipients, list):
        recipients = list(set(recipients))
    else:
        recipients = [recipients]

    # extend with the CC list
    if cc:
        recipients.extend(cc)

    # if debugging then send to ADMINS as well
    if settings.DEBUG:
        for _, admin_email in settings.ADMINS:
            recipients.append(admin_email)

    # this is a workaround to allow passing body text directly
    if template_name:
        body = render_to_string(template_name, context)
    else:
        body = context

    sender = settings.DEFAULT_FROM_EMAIL
    email_thread = threading.Thread(
        target=send_mail,
        args=(settings.EMAIL_SUBJECT_PREFIX + subject, body, sender, recipients),
        kwargs={'fail_silently': False}
    )
    # This is to tell Python not to wait for the thread to return
    email_thread.setDaemon(True)
    email_thread.start() 
Example 19
Project: steemprojects.com   Author: wise-team   File: mail.py    License: MIT License 5 votes vote down vote up
def send_validation(strategy, backend, code, partial_token):
    url = '{0}?verification_code={1}&partial_token={2}'.format(
        reverse('social:complete', args=(backend.name,)),
        code.code,
        partial_token
    )
    url = strategy.request.build_absolute_uri(url)
    msg = EmailMultiAlternatives(
        subject='{0} Validate your account'.format(settings.EMAIL_SUBJECT_PREFIX),
        body='Validate your account {0}'.format(url),
        from_email=settings.VALIDATION_EMAIL_SENDER,
        to=[code.email],
    )
    msg.esp_extra = {"sender_domain": settings.EMAIL_SENDER_DOMAIN}
    msg.send() 
Example 20
Project: yats   Author: mediafactory   File: shortcuts.py    License: MIT License 5 votes vote down vote up
def jabber_ticket(request, ticket_id, form, **kwargs):
    int_rcpt, pub_rcpt = list(get_jabber_recipient_list(request, ticket_id))
    tic = get_ticket_model().objects.get(pk=ticket_id)
    if not tic.assigned:
        if 'rcpt' in kwargs and kwargs['rcpt']:
            rcpts = kwargs['rcpt'].split(',')
            for rcpt in rcpts:
                if rcpt not in int_rcpt:
                    int_rcpt.append(rcpt)

    new, old = field_changes(form)

    if len(int_rcpt) > 0:
        try:
            new['author'] = tic.c_user
            send_jabber('%s#%s - %s\n\n%s\n\n%s' % (
                settings.EMAIL_SUBJECT_PREFIX,
                tic.id,
                tic.caption,
                format_chanes(new, True),
                get_ticket_url(request, ticket_id)
            ), int_rcpt)
        except:
            if not kwargs.get('is_api', False):
                messages.add_message(request, messages.ERROR, _('jabber not send: %s') % sys.exc_info()[1])

    if len(pub_rcpt) > 0 and has_public_fields(new):
        try:
            new['author'] = tic.u_user
            send_jabber('%s#%s - %s\n\n%s\n\n%s' % (
                settings.EMAIL_SUBJECT_PREFIX,
                tic.id,
                tic.caption,
                format_chanes(new, False),
                get_ticket_url(request, ticket_id, for_customer=True)
            ), pub_rcpt)
        except:
            if not kwargs.get('is_api', False):
                messages.add_message(request, messages.ERROR, _('jabber not send: %s') % sys.exc_info()[1]) 
Example 21
Project: yats   Author: mediafactory   File: shortcuts.py    License: MIT License 5 votes vote down vote up
def mail_ticket(request, ticket_id, form, **kwargs):
    int_rcpt, pub_rcpt = list(get_mail_recipient_list(request, ticket_id))
    tic = get_ticket_model().objects.get(pk=ticket_id)
    if not tic.assigned:
        if 'rcpt' in kwargs and kwargs['rcpt']:
            rcpts = kwargs['rcpt'].split(',')
            for rcpt in rcpts:
                if rcpt not in int_rcpt:
                    int_rcpt.append(rcpt)

    new, old = field_changes(form)

    if len(int_rcpt) > 0:
        try:
            new['author'] = tic.c_user
            send_mail('%s#%s - %s' % (settings.EMAIL_SUBJECT_PREFIX, tic.id, tic.caption), '%s\n\n%s' % (format_chanes(new, True), get_ticket_url(request, ticket_id)), settings.SERVER_EMAIL, int_rcpt, False)
        except:
            if not kwargs.get('is_api', False):
                messages.add_message(request, messages.ERROR, _('mail not send: %s') % sys.exc_info()[1])

    if len(pub_rcpt) > 0 and has_public_fields(new):
        try:
            new['author'] = tic.u_user
            send_mail('%s#%s - %s' % (settings.EMAIL_SUBJECT_PREFIX, tic.id, tic.caption), '%s\n\n%s' % (format_chanes(new, False), get_ticket_url(request, ticket_id, for_customer=True)), settings.SERVER_EMAIL, pub_rcpt, False)
        except:
            if not kwargs.get('is_api', False):
                messages.add_message(request, messages.ERROR, _('mail not send: %s') % sys.exc_info()[1]) 
Example 22
Project: yats   Author: mediafactory   File: shortcuts.py    License: MIT License 5 votes vote down vote up
def jabber_comment(request, comment_id):
    from yats.models import tickets_comments
    com = tickets_comments.objects.get(pk=comment_id)
    ticket_id = com.ticket_id
    int_rcpt, pub_rcpt = get_jabber_recipient_list(request, ticket_id)

    tic = get_ticket_model().objects.get(pk=ticket_id)

    if len(int_rcpt) > 0:
        try:
            send_jabber('%s#%s: %s - %s\n\n%s\n\n%s' % (
                settings.EMAIL_SUBJECT_PREFIX,
                tic.id,
                _('new comment'),
                tic.caption,
                com.comment,
                get_ticket_url(request, ticket_id)
            ), int_rcpt)
        except Exception:
            messages.add_message(request, messages.ERROR, _('internal jabber not send: %s') % sys.exc_info()[1])

    if len(pub_rcpt) > 0:
        try:
            send_jabber('%s#%s: %s - %s\n\n%s\n\n%s' % (
                settings.EMAIL_SUBJECT_PREFIX,
                tic.id,
                _('new comment'),
                tic.caption,
                com.comment,
                get_ticket_url(request, ticket_id, for_customer=True)
            ), pub_rcpt)
        except Exception:
            messages.add_message(request, messages.ERROR, _('internal jabber not send: %s') % sys.exc_info()[1]) 
Example 23
Project: yats   Author: mediafactory   File: shortcuts.py    License: MIT License 5 votes vote down vote up
def jabber_file(request, file_id):
    from yats.models import tickets_files
    io = tickets_files.objects.get(pk=file_id)
    ticket_id = io.ticket_id
    int_rcpt, pub_rcpt = get_jabber_recipient_list(request, ticket_id)

    tic = get_ticket_model().objects.get(pk=ticket_id)

    if len(int_rcpt) > 0:
        body = '%s\n%s: %s\n%s: %s\n%s: %s\n\n%s' % (_('new file added'), _('file name'), io.name, _('file size'), io.size, _('content type'), io.content_type, get_ticket_url(request, ticket_id))
        try:
            send_jabber('%s#%s: %s - %s\n\n%s' % (
                settings.EMAIL_SUBJECT_PREFIX,
                tic.id,
                _('new file'),
                tic.caption,
                body
            ), int_rcpt)
        except Exception:
            messages.add_message(request, messages.ERROR, _('jabber not send: %s') % sys.exc_info()[1])

    if len(pub_rcpt) > 0:
        body = '%s\n%s: %s\n%s: %s\n%s: %s\n\n%s' % (_('new file added'), _('file name'), io.name, _('file size'), io.size, _('content type'), io.content_type, get_ticket_url(request, ticket_id, for_customer=True))
        try:
            send_jabber('%s#%s: %s - %s\n\n%s' % (
                settings.EMAIL_SUBJECT_PREFIX,
                tic.id,
                _('new file'),
                tic.caption,
                body
            ), pub_rcpt)
        except Exception:
            messages.add_message(request, messages.ERROR, _('jabber not send: %s') % sys.exc_info()[1])