Python Not Sending Email To Multiple Addresses

后端 未结 3 989
忘掉有多难
忘掉有多难 2020-12-31 23:14

I can\'t see where i\'m going wrong with this, I hope someone can spot the problem. I\'d like to send an email to multiple addresses; however, it only sends it to the first

3条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 23:45

    Change

    toaddrs = ", ".join(recipients)
    

    to

    toaddrs = recipients
    

    since

    server.sendmail(fromaddr, toaddrs, ...)
    

    expects toaddrs to be a list of email addresses. (Or, of course, just use recipients in place of toaddrs.)

提交回复
热议问题