【发布时间】:2013-03-10 19:10:23
【问题描述】:
我刚刚实现了 django-mailer,因为它似乎是从 django 异步发送邮件的最佳方式。
出于某种原因,django-mailer 正在为收件人电子邮件地址的每个字母创建一个 db 条目,其中“收件人”字段中包含一个字母......这是一个屏幕截图:
http://i.imgur.com/Pqbx3oq.gif
为了不显示完整的地址,我已经删除了其余条目,但只要说所有条目的“收件人”字段加起来就是用户的电子邮件地址就足够了。 (澄清一下,发送一封电子邮件会为电子邮件地址的每个字母创建一个对象)。
生成邮件的代码是:
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)
在通知电子邮件中输出user_email 会正确提供整个电子邮件地址,所以我假设这是 django-mailer 保存功能的问题....?
非常感谢任何指点。
【问题讨论】:
标签: django django-mailer