【发布时间】:2013-06-12 19:34:12
【问题描述】:
models.py
class FollowerEmail(models.Model):
report = models.ForeignKey(Report)
email = models.CharField('Email', max_length=100)
views.py
def what(request):
""""""
follower = FollowerEmail.objects.filter(report=report)
list=[]
for email in follower:
list.append(email.email)
""""""""
if 'send_email' in request.POST:
subject, from_email, to = 'Notification',user.email, person.parent_email
html_content = render_to_string('report/print.html',{'person':person,
'report':report,
'list':list,
})
text_content = strip_tags(html_content)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to],bcc=[list], cc=['monKarek@live.com'])
msg.attach_alternative(html_content, "text/html")
msg.send()
以上是我发送电子邮件的 view.py,电子邮件正在正确发送到“收件人”地址。问题与密件抄送标签有关。我正在从 FollowerEmail 表中获取电子邮件并制作一个列表。我正在将该列表传递给密件抄送,因为密件抄送的电子邮件ID列表会很大,会超过3个。
如果列表有两个以上的电子邮件ID,应用程序没有发送邮件,如果是两个或一个,应用程序正在发送邮件。可能是什么问题
谢谢
【问题讨论】:
标签: django django-models django-forms django-templates django-views