我正在尝试使用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)