在Django中发送大量邮件 – 解压缩的值过多

weixin_38086437 2019-09-12 10:33:10
我正在尝试使用Django的mass_mail函数.下面的代码不断提出“Too Many Values to Unpack”错误,我无法弄清楚原因.我正在关注那些看似非常简单的文档(https://docs.djangoproject.com/en/1.5/topics/email/#send-mass-mail) – 我做错了什么?如果重要的话,发送电子邮件地址已经完成,但我看不出这件事. if matching_record.level == 1: users = self._get_users_to_be_notified(matching_record.category) email_recipients = [str(user.email) for user in users if user.email] message = 'Here is your requested notification that the service "%s" is having technical difficulties and has been set to "Critical".' %matching_record.name mail_tuple = ('Notification', message, 'notifications@service.com', email_recipients) send_mass_mail(mail_tuple)
...全文
17 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38118871 2019-09-12
  • 打赏
  • 举报
回复
send_mass_mail方法的第一个参数是消息元组的元组,但是你只发送一个消息元组.更改下面调用的函数并检查它是否有效: send_mass_mail((mail_tuple,))

435

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧