Odoo Help

Welcome!

This community 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.

0

sending mail from odoo; python script problem (?)

By
TS
on 11/17/14, 7:48 AM 1,907 views

Hello,

 

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: 89.78.255.67 - - [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?

 

regards

Tomasz

 

 

1
TS
On 11/17/14, 9:22 AM

hello,

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?

 

reagrds

Tomasz

 

 

..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.

 

regards

Tomasz

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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