This document describes an older version of Celery (2.5). For the latest stable version please go here.



How task error emails are formatted and sent.

  1. 2009 - 2012 by Ask Solem.

BSD, see LICENSE for more details.

class celery.utils.mail.ErrorMail(task, **kwargs)

Defines how and when task error e-mails should be sent.

Parameters:task – The task instance that raised the error.

subject and body are format strings which are passed a context containing the following keys:

  • name

    Name of the task.

  • id

    UUID of the task.

  • exc

    String representation of the exception.

  • args

    Positional arguments.

  • kwargs

    Keyword arguments.

  • traceback

    String representation of the traceback.

  • hostname

    Worker hostname.

body = '\nTask %(name)s with id %(id)s raised exception:\n%(exc)r\n\n\nTask was called with args: %(args)s kwargs: %(kwargs)s.\n\nThe contents of the full traceback was:\n\n%(traceback)s\n\n-- \nJust to let you know,\nceleryd at %(hostname)s.\n'

Format string used to generate error email content.

error_whitelist = None
send(context, exc, fail_silently=True)
should_send(context, exc)

Returns true or false depending on if a task error mail should be sent for this type of error.

subject = ' [celery@%(hostname)s] Error: Task %(name)s (%(id)s): %(exc)s\n '

Format string used to generate error email subjects.

class celery.utils.mail.Mailer(host='localhost', port=0, user=None, password=None, timeout=2, use_ssl=False, use_tls=False)
class celery.utils.mail.Message(to=None, sender=None, subject=None, body=None, charset='us-ascii')
exception celery.utils.mail.SendmailWarning

Problem happened while sending the email message.

Previous topic

Next topic


This Page