This blog was written for OpenERP version 5.0 may now work for current version !

During the review process i getting touch with the module mail_gateway which was simple migration of code from to module which seems tightly couplled with the crm module only.
During the process i get a idea to develope a clean moduel to interact with the emails and easy integration with other modules too.
I have started a development for the same, and it is ready to use now also replaces the module email_gateway. we also required email sending facility, when we are going to make a powerfully email receiver like fetchmail to enreach openerp by email functionalities. as we have already module smtpclient that is powerful, and integrated email sending tool.
mail_gateway = smtpclient + fetchmail
Now, we will have a new menu structure when we can access all email services (sending, receiving and queing and history of the same)
Normally emails sending functions is used at many places in erp, crm is the only module in the beginning which act based on email receive. which also take care for the new email or old email continuous conversation. there are so many things to tcke care if we going to design a generic module for the email receive as email can be a new email or reply of the previous emails which is not always specific to the crm module.
To keep the track of the every in system we design a message history which will histories the very minimal information to identify the email easily and get the reference of the same. Message-Id is the most important value also References is the one more important value to track the continuous communications.
Methods to be supplied in orer to work with fetchmail.
def message_new(self, cr, uid, msg, context):
called by the fetchmail module when new email arrives
def message_update(self, cr, uid, ids, vals={}, msg=””, default_act=None, context={}):
called by the fetchmail when reply will come for an continuous communication.

General Configuration of Fetchmail Server

In process parameter model is the most important parameter based on that fetchmail will be able to decide that which object is to be notify when new email arries in to the syste.
Here, again we are going to use the power of server action feature in Auto Reply field. it will be domain based allow to select only email actions, so that we can easily configure that what and how to reply for the incoming emails.
We can fetch emails by the following protocols
  • IMAP without SSL
  • IMAP with SSL
  • POP3 without SSL
  • POP3 with SSL

About the message format

In both the methods variable msg will be use to describe message in easy and understabdale format, so it will be easy for routin programmer to interact with the email easily without doing much processing.
Here are the few fields mapping
Email Fields = OpenERP Fields
Message-ID = id or message-id
Subject = subject
Content-Type = content-type
From = from
Delivered-To = to
Cc = cc
Date = date
Content-Transfer-Encoding = encoding
References = references
X-Priority = priority
Multi part (message text) = body
Multipart (Message Attachments) = attachments
Using the openerp field its will be easy to play with the emails data.
Look at the user inbox for the OpenERP support case, its displayed in the threats and not like the previous view each time new emails, now it reference with the previous communications.

One thought on “Fetchmail Module – replaceent of

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s