Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Internet > HTTP (WWW)

    django-mailer 0.1.0

    Download button

    No screenshots available
    Downloads: 287  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    James Tauber | More programs
    MIT/X Consortium Lic... / FREE
    August 24th, 2009, 02:30 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    django-mailer description

    A reusable Django app for queuing the sending of email

    django-mailer is asynchronous so in addition to putting mail on the queue you need to periodically tell it to clear the queue and actually send the mail.

    The latter is done via a command extension.

    Sample Use Cases

    * a site admin wants to send a one-off announcement to all users on a site
    * a site admin wants to send a one-off email to a subset of users (e.g. thank you note to users who completed a survey)
    * a site admin wants to send an email but wants to defer it to a particular date or time (e.g. send out at 9am tomorrow a reminder of the scheduled downtime at 10am)
    * a site admin wants to send a regular email to a subset of users (e.g. people who haven't logged in for over a month)
    * a user wants email notification when certain events specific to them happen (e.g. a friend accepts their invitation to join a group, they receive a private message)
    * a user wants email notification when certain events relevant to a subset of users happen (e.g. there has been a reply to a message board thread or blog entry that the user has subscribed to)
    * a user doesn't want individual emails for each notification but wants them in digest form (e.g. a daily digest of new posts or a weekly update on friends who have joined)

    Scope Questions

    * django-mailer should not manage actual subscriptions to events. Consider the "new reply to message board thread" use case. The overall site would need to keep track of which users subscribed to which threads and then when a thread is updated, django-mailer would be asked to send the same message to that list of users. But the django-notification app should keep track of which users subscribed to which threads and similar use cases.

    Putting Mail On The Queue

    Because django-mailer currently uses the same function signature as Django's core mail support you can do the following in your code:

    # favour django-mailer but fall back to django.core.mail
    from django.conf import settings

    if "mailer" in settings.INSTALLED_APPS:
     from mailer import send_mail
    else:
     from django.core.mail import send_mail


    and then just call send_mail like you normally would in Django:

    send_mail(subject, message_body, settings.DEFAULT_FROM_EMAIL, recipients)

    Additionally you can send all the admins as specified in the ADMIN setting by calling:

    mail_admins(subject, message_body)

    or all managers as defined in the MANAGERS setting by calling:

    mail_managers(subject, message_body)

    Clear Queue With Command Extensions

    With mailer in your INSTALLED_APPS, there will be two new manage.py commands you can run:

     * send_mail will clear the current message queue. If there are any failures, they will be marked deferred and will not be attempted again by send_mail.
     * retry_deferred will move any deferred mail back into the normal queue (so it will be attempted again on the next send_mail).

    You may want to set these up via cron to run regularly:

    * * * * * (cd $PINAX; /usr/local/bin/python2.5 manage.py send_mail >> $PINAX/cron_mail.log 2>&1)
    0,20,40 * * * * (cd $PINAX; /usr/local/bin/python2.5 manage.py retry_deferred >> $PINAX/cron_mail_deferred.log 2>&1)


    This attempts to send mail every minute with a retry on failure every 20 minutes.

    manage.py send_mail uses a lock file in case clearing the queue takes longer than the interval between calling manage.py send_mail.



    Product's homepage

    Requirements:

    · Django
    · Python

      


    TAGS:

    query mail | send mail | Django plugin | Django | mail | sender



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM