Skip to content

mail queuing and management for the Django web framework

License

Notifications You must be signed in to change notification settings

duh386/django-mailer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

>>>django-mailer by James Tauber <http://jtauber.com/>
>>>http://code.google.com/p/django-mailer/

>>>A reusable Django app for queuing the sending of email

Add possibility to sending email from second queue and authorization. For using it, you should provide additional (bool) 'is_mass' parameter into sending functions. 
If True, application will use EMAIL_HOST_USER_MASS and EMAIL_HOST_PASSWORD_MASS parameters from settings.py for authorization. Many smtp servers check, if "from_email" param coincide with authorization username, and they return error if no. To avoid it, pass "from_email" param manually. Also there is next algorithm in sendin: email is sent in some attempts with interval between them. There is some settings for managing them:
MAILER_MASS_QUEUE_SIZE = <int> # Count of letters in one attempt
MAILER_MASS_QUEUE_INTERVAL = <int> # Interval in minutes between attempts
MAILER_MASS_QUEUE_ATTEMPTS = <int> # Count of attempts

All additional parameters is required

EXAMPLES

settings.py: 

EMAIL_HOST_USER = 'user1@gmail.com'
EMAIL_HOST_PASSWORD = 'password1'
EMAIL_HOST_USER_MASS = 'user2@gmail.com'
EMAIL_HOST_PASSWORD_MASS = 'password2'
MAILER_MASS_QUEUE_SIZE = 5
MAILER_MASS_QUEUE_INTERVAL = 1
MAILER_MASS_QUEUE_ATTEMPTS = 3

sending email:

from django.conf import settings
import mailer

mailer.send_html_mail('Email subject', 'email text', '<b>email text</b>', from_email=settings.EMAIL_HOST_USER, recipient_list=('to_email@gmail.com',))
# Message will be sent with EMAIL_HOST_USER and EMAIL_HOST_PASSWORD authorization

mailer.send_html_mail('Email subject', 'email text', '<b>email text</b>', from_email=settings.EMAIL_HOST_USER_MASS, recipient_list=('to_email@gmail.com',), is_mass=True)
# Message will be sent with EMAIL_HOST_USER_MASS and EMAIL_HOST_PASSWORD_MASS authorization and will be use attempts algorithm.

python manage.py send_mail ; starting sending for letters with is_mass=False (by default)
python manage.py send_mass_mail ; starting sending for letters with is_mass=True. Letters will be sent in 3 attempts with 5 units in each one.

About

mail queuing and management for the Django web framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%