Merge branch 'feedback'

pull/1/head
Raymond Yee 2012-07-09 10:09:59 -07:00
commit a5d0ef36d7
1 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,7 @@ logger = logging.getLogger(__name__)
from celery.task import task
from django.contrib.auth.models import User
from django.conf import settings
from regluit.core import bookloader, models
from regluit.core import goodreads, librarything
@ -60,8 +61,15 @@ def fac(n, sleep_interval=None):
@task
def send_mail_task(subject, message, from_email, recipient_list,
fail_silently=False, auth_user=None, auth_password=None,
connection=None):
"""a task to drop django.core.mail.send_mail into """
connection=None, override_from_email=True):
"""a task to drop django.core.mail.send_mail into """
# NOTE: since we are currently using Amazon SES, which allows email to be sent only from validated email
# addresses, we force from_email to be one of the validated address unless override_from_email is FALSE
if override_from_email:
try:
from_email = settings.DEFAULT_FROM_EMAIL
except:
pass
return send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=auth_user,
auth_password=auth_password, connection=connection)