I've just implemented django-mailer as it seemed to be the best way to send mail asynchronously from django.
For some reason, django-mailer is creating a db entry for each letter of the recipient's email address, with the "To" field having one letter in it.... Here's a screenshot:
http://i.imgur.com/Pqbx3oq.gif
I've cut off the rest of the entries so as not to show the full address, but suffice it to say that the "To" fields of all the entries add up to the user's email address. (To clarify, sending one email creates an object for each letter of the email address).
The code which generates the mail is:
from mailer import send_mail
from notifications.models import EmailNotifications
users_to_email = EmailNotifications.objects.filter(\
product=product)
if users_to_email:
for user_to_email in users_to_email:
the_score = self.rating
user = user_to_email.user
name = '%s %s' % (str(user.first_name),\
str(user.last_name))
user_email = user.email
theSubject = 'Score Notification'
theMessage = render_to_string('notification-email.txt',
{'the_score': the_score,
'name': name,
'user': user,
'user_email': user_email})
send_mail(theSubject, theMessage, SERVER_EMAIL,\
user_email)
Outputting user_email
in the notification-email gives the whole email address correctly, so I'm assuming that this is a problem with the django-mailer save function....?
Very grateful for any pointers.