1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00
django-mailbox/docs/topics/signal.rst

22 lines
765 B
ReStructuredText
Raw Permalink Normal View History

2013-01-22 20:37:11 -08:00
Subscribing to the incoming mail signal
=======================================
To subscribe to the incoming mail signal, following this lead::
from django_mailbox.signals import message_received
from django.dispatch import receiver
@receiver(message_received)
def dance_jig(sender, message, **args):
print "I just recieved a message titled %s from a mailbox named %s" % (message.subject, message.mailbox.name, )
2013-06-24 00:20:08 -07:00
.. warning::
`As with all django signals <https://docs.djangoproject.com/en/dev/topics/signals/>`_,
this should be loaded either in an app's ``models.py``
or somewhere else loaded early on.
If you do not load it early enough, the signal may be fired before your
signal handler's registration is processed!