diff --git a/product/ERP5/Tool/NotificationTool.py b/product/ERP5/Tool/NotificationTool.py index 2f7c6012eb50c8c929f587779aad70e76a492cf7..bf7a45d8a54d1305cfa3a912db1e9f73da950938 100644 --- a/product/ERP5/Tool/NotificationTool.py +++ b/product/ERP5/Tool/NotificationTool.py @@ -135,10 +135,8 @@ def buildEmailMessage(from_url, to_url, msg=None, message.add_header('To', to_url) for attachment in attachment_list: - if attachment.has_key('name'): - attachment_name = attachment['name'] - else: - attachment_name = '' + attachment_name = attachment.get('name', '') + # try to guess the mime type if not attachment.has_key('mime_type'): type, encoding = guess_type( attachment_name ) @@ -164,8 +162,8 @@ def buildEmailMessage(from_url, to_url, msg=None, part.set_payload(attachment['content']) Encoders.encode_base64(part) - part.add_header('Content-Disposition', - 'attachment; filename=%s' % attachment_name) + part.add_header('Content-Disposition', 'attachment', + filename=attachment_name) part.add_header('Content-ID', '<%s>' % \ ''.join(['%s' % ord(i) for i in attachment_name])) message.attach(part)