Skip to content

Commit

Permalink
use django-mailer if available
Browse files Browse the repository at this point in the history
git-svn-id: http://django-email-confirmation.googlecode.com/svn/trunk@27 e143efbd-a74b-0410-b764-bd10452ab0ba
  • Loading branch information
jtauber committed May 21, 2008
1 parent 0c1f0b9 commit 44eda2d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions devproject/emailconfirmation/models.py
Expand Up @@ -4,7 +4,13 @@

from django.db import models, IntegrityError
from django.template.loader import render_to_string
from django.core.mail import send_mail

# favour django-mailer but fall back to django.core.mail
try:
from mailer import send_mail
except ImportError:
from django.core.mail import send_mail

from django.conf import settings

from django.contrib.auth.models import User
Expand Down Expand Up @@ -85,11 +91,7 @@ def send_confirmation(self, email_address):
"user": email_address.user,
"confirmation_key": confirmation_key,
})
# @@@ eventually use django-mailer
if settings.EMAIL_DEBUG:
print message
else:
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [email_address.email])
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [email_address.email])

return self.create(email_address=email_address, sent=datetime.now(), confirmation_key=confirmation_key)

Expand Down

0 comments on commit 44eda2d

Please sign in to comment.