模型.py
class FollowerEmail(models.Model):
report = models.ForeignKey(Report)
email = models.CharField('Email', max_length=100)
视图.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 个。
如果列表有超过 2 个电子邮件 id,应用程序没有发送邮件,如果是两个或一个,应用程序正在发送邮件。可能是什么问题
谢谢