Martin - there is a question if you don't mind answering (I would be very glad to get an answer). I'm interested in importing all mail messages from my account, which has been sent directly to me (for example, if my company is @company.com, then I want to have all mails, which have been addressed to me (like email@example.com, where mariusz is my alias), fetched to OpenERP. Here is the code I've modified:
result, data = imap_server.search(None, '(ALL)')
for num in data.split():
result, data = imap_server.fetch(num, '(RFC822)')
to = filter(lambda l: l.startswith("To: "), data.split("\n\n").split("\n")).split(" ", 1)
_logger.info("to: %s", to)
if not to.endswith("@company.com"):
except Exception, e:
_logger.info("exception with address %s", str(e))
res_id = mail_thread.message_process(cr, uid, server.object_id.model,
The problem here is that headers are being processed well, but in the end OpenERP fetch 0 mails - what is the problem here? I wasn't able to trace bug here, whole fetchmail processes as follows, but gives 0 exceptions (and it should).
It returns a lot of results like
INFO test openrp.addons.fetchmail.fetchmail: to: <firstname.lastname@example.org>, but also mails which are not in the domain
@company.com. Any help would be appreciated.