[英]make a list of recipients to use it at send_mail
我將在for loop
創建一個收件人列表,然后使用send_mail
:
for participant in participants:
list.append(participant.mail)
然后:
send_mail(email_subject,email_body,'sender@gmail.com',list,fail_silently=False)
制作此列表的正確方法是什么?
那么,假設你定義了一個要使用的列表,你所擁有的將會起作用,首先:
emails = []
for participant in participants:
emails.append(participant.email)
但是,列表理解更容易:
emails = [p.email for p in participants]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.