Odoo Help


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.


How can we process incoming emails

Kurt Haselwimmer
on 8/24/14, 2:23 AM 3,476 views

I wish to send emails to odoo to change data in specified records of an existing model in the system. Is there any documentation on this subject or a clear example that shows how to process a general purpose emal? As I wish to run on odoo-on-saas I cannot write a custom module but would be obliged to process the incoming email and update my data purely via server actions.

There are one or two posts on this system but these are out of date (the crm.lead description field is no longer written by the incoming email for example). Also there is no clear indication of whether a new record MUST be created - I have tried leaving this field blank and setting it to create a record of type message and neither seems to work.

Anders Wallenquist
On 8/24/14, 5:29 AM

Create an imap catchall-account for your domain and configure incomming mail for this account (settings -> General Settings). Odoo will create mail-aliases for most of you objects (settings -> Email -> Alias), you can also add you own aliases.

You can also add more incomming mail accounts and administer "Actions to Perform on Incoming Mails".



Anders thanks for the comment but this does not explain how to extract and act upon data extracted from the body of the email. This requires a server action - the previous posts that touch on this subject are clearly out of date now.

Kurt Haselwimmer
on 8/24/14, 5:45 AM

You can add server actions in python-code for example: if context.get('active_model') == 'crm.lead' and context.get('active_ids'): self.case_mark_lost(cr, uid, context['active_ids'], context=context)

Anders Wallenquist
on 8/24/14, 5:50 AM

A worked example would help me and many other people I think. The existing semi-examples posted on odoo help have typos and also no longer work. 1 Its not clear whether a database record always needs to be created - eg if we just want to update, say a status field in a delivery order we don't need a new lead or delivery order to be created. 2 If we are not creating a record in one of the models how do we access the fields (subject, body etc) from the incoming email message. I tried creating message records but this does not seem to work (on saas5). If this can be demonstrated then it provides a useful mechanism for synchronisation with other online systems.

Kurt Haselwimmer
on 8/24/14, 5:56 AM

Med Said BARA

--Med Said BARA--
| 5 5 7
--Med Said BARA--
Med Said BARA
On 8/24/14, 8:42 AM

Very interesting question.

But, how to parse the email content ?

Related question: https://www.odoo.com/forum/help-1/question/customize-the-auto-lead-creation-through-incoming-emails-272


Some links:



Can you tell me what you think about : https://github.com/Smile-SA/odoo_addons/tree/7.0/smile_action_trigger


The first ref 1) is the classic one on this forum - this didn't work because of the typos shown in 2. 2) no longer works because the email body is no longer put into the crm.lead description field when the email is received (this change was uploaded to github around feb 2013) 3) is a zapier reference. I assume that this requires a custom module in odoo and so is therefore incompatible with odoo-on-saas I have not come across 5) before - but it too looks like it would require a custom module to be installed in odoo - again making it incompatible with odoo-on-saas. I am sure that this must be possible with odoo server actions - it is just knowing how to get access to the email body content. After that we can parse that content and do pretty much whatever we would like with server actions.

Kurt Haselwimmer
on 8/24/14, 10:23 AM

I think the email can be accessed via mail.mesagge model. The problem is how to trigger the server actions object?

Ben Bernard
on 8/25/14, 2:55 AM

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)


Asked: 8/24/14, 2:23 AM
Seen: 3476 times
Last updated: 8/30/15, 9:40 PM