A reusable Django app for queuing the sending of email
Forked to support multiple accounts and email throttling.
Forked to allow
django-mailer to use multiple email accounts and to impose a daily sending limit per email account.
Specifically made for Google Apps users who have a 500 email a day per user sending limit and are also limited to a
from_address that is the actual authenticated account.
If you'd like to use different "from" emails, it's currently not an option with google apps.
Specify an optional
settings.py to limit the amount of emails per 24 hours.
Throttling is done via emails sent in the last 24 hours, not discrete days.
# settings.py MAILER_DAILY_SENDING_LIMIT = 400
send_mail takes an extra keyword argument,
account, which is an integer mapped to a specific account in
Account 0 is mapped to the default email settings
Account 1 is mapped to
All settings below are required and mailer will complain if it fails to find a setting.
# settings.py EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST_USER = 'email@example.com' EMAIL_HOST_PASSWORD = 'password' EMAIL_USE_TLS = True EMAIL1_HOST = 'smtp.gmail.com' EMAIL1_PORT = 587 EMAIL1_HOST_USER = 'firstname.lastname@example.org' EMAIL1_HOST_PASSWORD = 'password' EMAIL1_USE_TLS = True
from mailer import send_mail send_mail("Subject", "Body", "email@example.com", ["firstname.lastname@example.org"]) # uses default email settings send_mail("Subject", "Body", "email@example.com", ["firstname.lastname@example.org"], account=1) # uses EMAIL1_* settings send_mail("Subject", "Body", "email@example.com", ["firstname.lastname@example.org"], account=2) # uses EMAIL2_* settings bash $ python manage.py send_mail # iterates through Messages by account and sends up to DAILY_SENDING_LIMIT per account if specified.