0
models.py無法發送電子郵件到2個以上的電子郵件地址
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=['[email protected]'])
msg.attach_alternative(html_content, "text/html")
msg.send()
以上是我view.py發送電子郵件,電子郵件被髮送到「以「地址正確。問題是與密件抄送標記。我從FollowerEmail表和製作一個列表。我將該列表傳遞給密件抄送,因爲密件抄送電子郵件ID列表將大,將超過3.
如果列表中有超過2個電子郵件ID,摺疊不發送郵件,如果是兩個或一個應用程序發送mail.What可能是問題
感謝
,它工作....謝謝 –