Thursday, 15 August 2013

Send mass mail in Django -- Too many values to unpack

Send mass mail in Django -- Too many values to unpack

I'm experimenting with Django's mass_mail function. The code below keeps
raising a "Too Many Values to Unpack" error, and I can't figure out why.
I'm following the docs
(https://docs.djangoproject.com/en/1.5/topics/email/#send-mass-mail) which
seem pretty straightforward--what am I doing wrong? If it matters, the
send-email address is made up, but I can't see that mattering.
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)

No comments:

Post a Comment