KeyError in mail.py on checkout success, line 159

Create issue
Issue #1183 resolved
Former user created an issue

This line:

%s""" % (",".join(send_mail_args['recipient_list']), send_mail_args['subject'], send_mail_args['message']))

I changed it to:

%s""" % (",".join(send_mail_args['to']), send_mail_args['subject'], send_mail_args['body']))

and it fixed the error(s) and sends mail correctly.

Comments (7)

  1. Former user Account Deleted

    having similiar issue... I'm assuming this is definitely a bug? wondering if anybody is going to commit it.

  2. Dave Brown

    actually this only occurred for me because I didnt have my email settings configured in settings.py.

  3. edub

    I also ran into this issue - upon copying my email settings over from my deployment settings it was remedied. However, I still think this is a bug that should be addressed.

  4. Chris Moffitt repo owner

    I'm open to ideas on how best to handle this. Feel free to attach a patch or specific recommendation about how we could best handle this.

  5. Artem Gluvchynsky
    • changed status to open

    The reason why this bug happens is that related signal listeners are allowed to change send_mail_args dict that's being passed to them. Specifically built-in send_html_email does that by popping elements from it.

    IMO, since Satchmo expects this to be changed by listeners, it should at least keep things working with its built-in functions while leaving responsibility for user-defined listeners on them.

    Here's my proposed change, please check it out: https://bitbucket.org/excieve/satchmo/changeset/dfba6e374dc5

    I've also changed recipients check after signal processing in send_store_email as it is more reliable that way. If listener changes it like this:

    send_mail_args['recipient_list'] = []
    

    then 'recipients' variable won't be changed.

  6. Log in to comment