Odoo Help


sending mail from odoo; python script problem (?)

Tomasz Serwanski
on 11/17/14, 7:48 AM 3,076 views



Just configured external email accounts (odoo is working on vps, while my mails provider works on other servers); configuring outgoing & incoming mail seem to be successful (odoo says it works at least).

I am able to send 'plain' mail (for example by 'reply' to any mail from inbox history); in logs I see after:

2014-11-17 12:40:40,503 1993 INFO MundoMio openerp.addons.mail.mail_mail: Mail with ID 9 and Message-Id u'<1416228037.600449085235596.120677993934762-openerp-6-sale.order@xxxxxxxxx.ovh.net>' successfully sent

What is interesting when trying to send any mail with attachment (for example sale quotation), it seems to be impossible; logs say:

2014-11-17 12:39:27,246 1993 ERROR MundoMio openerp.addons.mail.mail_mail: failed sending mail.mail 8
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/mail_mail.py", line 254, in send
    ['datas_fname', 'datas'])]
  File "/usr/lib/python2.7/base64.py", line 73, in b64decode
    return binascii.a2b_base64(s)
TypeError: must be string or buffer, not bool

Unfortunately my python knowledge is minimal, but it seem to me there is problem with handling mails with attachments. What may also shed some light, when I am browsing inbox -> archive, when trying to open any attachment shown in archive as sent, web page opens with message:

Not Found

The requested URL was not found on the server.

If you entered the URL manually please check your spelling and try again.

and relevant entries in log are:

2014-11-17 12:45:18,812 1993 WARNING MundoMio openerp.http: <function openerp.addons.mail.controllers.main.download_attachment> returns an invalid response type for an http request
2014-11-17 12:45:18,817 1993 INFO MundoMio werkzeug: - - [17/Nov/2014 12:45:18] "GET /mail/download_attachment?model=mail.message&id=96&method=download_attachment&attachment_id=58 HTTP/1.1" 404 -

Did anyone faced similar problem? If so, what was solution?






Tomasz Serwanski
On 11/17/14, 9:22 AM


believe found something what may help a bit:

- I can send mail with attachment; can send mail from any page in odoo, can add attachment and send it - only condition is that the attachment needs to be uploaded from local pc; then it works

- if mail is to be sent with attachmet alread loaded (or the one which should be loaded) to server/cache (not sure), then send will fail; message as above (..must be string or buffer, not bool..) suggests, that when sending such an attachment odoo finds only nulll in place, where attachment should be located.

In my case mentioned attachmets are created by 'event' module (I've created events, and I am selling them via odoo webpage); when person is buying ticket, he/she comes through purchase process, which ends up with message '..your order will be processed..'. From his/her point of view all seems ok, except fact that mail sent by odoo does not reach customer (ends with error as above). Because of that, I believe that event and/or ecommerce module creates attachments in somehow wrong way, but I am unable to fing out what may be wrong. As a workaround I would like to change mail template to disable adding attachmet to it - but have no idea where to look for mail templates; anyone can advice?






..and finally found answer - seems that similar problems are in place always when:

- odoo needs to create .pdf attachment, and

- whhtmltopdf is not configured/installed correctly

Just fixed problems with wkhtmltopodf and problem is solved. Hope above may help someone with similar issues.




About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 11/17/14, 7:48 AM
Seen: 3076 times
Last updated: 3/16/15, 8:10 AM