Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

Poweremail 收件 邮件标题 以及 收(发)件人 地址乱码问题修正




  • 影响 PowerEmail for OpenERP 0.6.3及以下版本. 听说 0.7 版本已修正...
    解决方案由 广州-hugo(150672834) 提供. mrshelly做相关整理

    poweremail_core.py 文件

    save_header
    save_fullmail
    complete_mail
    三个方法中. 对于 vals['pem_from'], vals['pem_to'], vals['pem_subject'] 三个值做处理
    其中 vals['pem_from'] vals['pem_to'] 使用 email.utils.parseaddr() 方法处理, 并获取出里面的邮件地址回存.
    相关代码:

    <br />....<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;pem_from&#039;:email.utils.parseaddr(mail&#91;&#039;From&#039;])[1],<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;pem_to&#039;:email.utils.parseaddr(mail&#91;&#039;To&#039;])[1] or &#039;no recepient&#039;,<br />....<br />
    



    vals['pem_subject'] 则将 Quoted Printable 格式转成正常的 unicode 串.
    相关代码:

    <br />....<br />&nbsp; &nbsp; &nbsp; &nbsp; h = email.Header.Header(mail&#91;&#039;subject&#039;])&nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; dh = email.Header.decode_header(h)&nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; subject = dh[0][0]<br />....<br />....<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;pem_subject&#039;:subject,<br />....<br />
    




    get_payloads
    这个方法中, 主要在处理 multipart 的附加内容时 没有进行 Quoted Printable -->Unicode String 的转换. 所以 转换后. 附件就处理正常了.
    相关代码:

    <br />....<br />&nbsp; &nbsp; &nbsp; &nbsp; for part in mail.walk():<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mail_part_type = part.get_content_type()<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if mail_part_type == &#039;text/plain&#039;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parsed_mail&#91;&#039;text&#039;] = tools.ustr(part.get_payload(decode=True))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif mail_part_type == &#039;text/html&#039;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parsed_mail&#91;&#039;html&#039;] = tools.ustr(part.get_payload(decode=True))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif not mail_part_type.startswith(&#039;multipart&#039;):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parsed_mail&#91;&#039;attachments&#039;].append((mail_part_type, tools.ustr(email.Header.decode_header(part.get_filename())[0][0]), part.get_payload(decode=True)))<br />&nbsp; &nbsp; &nbsp; &nbsp; return parsed_mail<br />....<br />