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

def dance_jig(sender, message, **args):
    print "I just recieved a message titled %s from a mailbox named %s" % (message.subject,, )


As with all django signals, this should be loaded either in an app’s 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!