Skip to content

Commit

Permalink
return actual number of sent messages as asked here:
Browse files Browse the repository at this point in the history
  • Loading branch information
jbinary committed Nov 15, 2012
1 parent aceeee7 commit c416c1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions database_email_backend/backend.py
@@ -1,14 +1,14 @@
#-*- coding: utf-8 -*-
from email.MIMEBase import MIMEBase

from django.core.mail.backends.base import BaseEmailBackend
from django.utils.encoding import smart_unicode

from database_email_backend.models import Email, Attachment


class DatabaseEmailBackend(BaseEmailBackend):
def send_messages(self, email_messages):
if not email_messages:
return
for message in email_messages:
email = Email.objects.create(
from_email = u'%s' % message.from_email,
Expand All @@ -35,3 +35,5 @@ def send_messages(self, email_messages):
content=content,
mimetype=mimetype
)
return len(email_messages)

0 comments on commit c416c1e

Please sign in to comment.