PrestaShop/PrestaShop — pull request #1202 by misthero (2014-01-06 11:42:41+00:00)
Title: Make IMAP option "Create new threads" work

The option: "Create new threads" (Create new threads for unrecognized emails ) is already there but not working.

When you check that option the PS_SAV_IMAP_CREATE_THREADS variable is correctly set, and indeed messages are really scanned and imported and customer threads created in database for "unrecognized mails" but they never show on BO because the shop_id is 0 for those ct and some other bug inside the controller

This patch does 3 things:
1) show in backoffice message sent to customer service even if directly sent by mail without using the contact page (only when the option is checked)

Than I added 2 new functionalities to that:

2) it is now able to insert the message in the right customer thread "category" (if you have more than one like support or suggestions etc..) depending on the mail the message is directed to.

3) it is now able to detect if the mail sending the message is owned by one of the registered customer and assign it to him showing customer details correctly (like customer name)