Changes

m
Line 28: Line 28:  
'''Port of email IMAP server / Imap encryption''': Choose 993 / SSL
 
'''Port of email IMAP server / Imap encryption''': Choose 993 / SSL
   −
'''Host charset''': Choose UTF-8. May be US-ASCII with some version/setup of Office365.
+
'''Host charset''': Choose UTF-8 (works 95% of time). May be US-ASCII with some version/setup of Office365.
    
'''Authentication mode'''
 
'''Authentication mode'''
Line 58: Line 58:     
Choose the action to do on collected emails.
 
Choose the action to do on collected emails.
 +
    
=Usage=
 
=Usage=
Let the job scheduler being executed automatically and see your data being recorded into Dolibarr.
+
Let the job scheduler ([[Module Scheduled jobs]]) being executed automatically to run the Email collectore and see your data being recorded into Dolibarr.
 +
 
 +
To avoid to wait the batch, you can force to execute the email collector manually from the Email collector record with the button "'''Run now'''". When making test, a good practice is to set the maximum number of email collected to a low value.
 +
 
 +
A test mode is available (button '''Test'''). This mode does not cause any modification of your mailbox (just reading) nor modification in Dolibarr. On the other hand, it allows you to see the different stages of the selection of qualified email, the filter and the processing of the actions that would be applied if we were not in test mode. This is an important feature to fine-tune the configuration of the collector.
 +
 
 +
== Trouble shooting ==
 +
If you got the error "connection setup failed - authenticate" with Google OAuth and your OAuth token + refresh works, check the Login (email) in your Emailcollector setup.
 +
 
 +
== Example of use case: Using Emailcollector for a support center ==
 +
You have a support center with n employees. The email of your support center is support@mycompany.com (an independant email or a mailing-list that dispatch any input email to the n employees).
 +
 
 +
You must:
 +
* Declare/Allow the email support@mycompany.com as a possible sender email for each employee (Example on Gmail: click on the menu wheel "Parameters", See All parameters, tab "Accounts and import", in section "Send email as", click on "Add another email", enter the email support@mycompany.com but uncheck the checkbox "alias", then click on link received by email to validate the new sender profile, go back in section "Send email as" and check the option "Reply from the same address the message was sent to").
 +
So it will be possible for every employee to send/answer emails as the  sender support@mycompany.com. So if the customer answer email of any employee, the answer will be sent to support@mycompany.com (so the n employees will also receive it).
 +
* Once this is done, if the email support@mycompany.com is a Mailing-List, it is recommended to create another email account, for exemple *followsupport@mycompany.com* and include it as another member of the mailing list support@mycompany.com. So followsupport@mycompany.com will receive any emails and answers inside the Inbox.
 +
* Enable the [[Module EMail Collector]] and the [[Module Ticket]].
 +
* In the setup of the ticket module, set the field "Force an email as CC recipient to all messages send from ticket page" to support@mycompany.com, so any email send from a ticket in Dolibarr backoffice will aslo be sent to support@mycompany.com.
 +
* In the setup of the ticket module, create one EmailCollector entry with credentials (IMAP login or OAuth) of the "followsupport" user as the user to connect to IMAP, and "Inbox" as the input directory. You can set the output directoy as "Processed emails" (you must create the directory or label before the first run). As the inbox is dedicated to followsupport@mycompany.com email, no need to set filters.
 +
 
 +
Imagine that the received emails are formated by a web form and has this content:
 +
 
 +
Organization: A customer or name
 +
Email: acustomeremail@example.com
 +
 
 +
Set the action to "Load the thirdparty by searching name/alias/email/id (load only)" with parameters
 +
 
 +
name=EXTRACT:BODY:Organization:\s*([\w\-\s]+)$
 +
email=EXTRACT:BODY:Email:\s*([\w\.\-]+@[a-zA-Z\.\-]+)
 +
 
 +
If the received email has no known format, you can't reuse content to guess the company name. So only the sender email will be used.
 +
 
 +
Then set a second action that is "Create or complete a ticket" (no parameters).
 +
 
 +
So each time an email is received to support@mycompany.com, or an answer is done, the user follow@mycompany.com receive the email and the collector will use it, trying to guess if it is a input or output email and will record a help desk ticket or complete a ticket..
 +
 
 +
== Example of use case: Create an opportunity for a team of sales ==
 +
You have a sale team with n employees. The email of your team is sales@mycompany.com (an independant email or a mailing-list that dispatched any input email to the n employees).
 +
 
 +
You must:
 +
 
 +
* Declare the email sales@mycompany.com as a possible sender email for each employee (but uncheck the checkbox "alias" if using Gmail). So it will be possible for every employee to send/answer emails as the  sender sales@mycompany.com. So if the customer answer email of any employee, the answer will be sent to sales@mycompany.com (so the n employee will also receive it).
 +
 
 +
* Once this is done, if the email sales@mycompany.com is a Mailing-List, it is recommended to create another email account, for exemple *followsales@mycompany.com* and include it as another member of the mailing list sales@mycompany.com. So followsales@mycompany.com will receive any emails and answers inside its Inbox.
 +
* Enable the [[Module EMail Collector]] and the [[Module Projects]] with option "Allow opportunity management" to On.
 +
* Create one EmailCollector entry with credentials (IMAP login or OAuth) of the sales mailbox. You can set the output directoy as "Processed emails" (you must create the directory or label before the first run). As the Inbox is dedicated to followsales@mycompany.com email, no need to set filters.
 +
 
 +
Imagine that the received emails are formated by a web form and has this content:
   −
To avoid to wait the batch, you can force to execute the email collector manually from the Email collector record with the button "Run now". When making test, a good practice is to set the maximum number of email collected to a low value.
+
Organization: A customer or name
 +
Email: acustomeremail@example.com
   −
A test mode is available. This mode does not cause any modification of your mailbox (just reading) nor modification in Dolibarr. On the other hand, it allows you to see the different stages of selection, the filter and the processing that would be applied if we were not in test mode.
+
Set the action to "Load the thirdparty by searching name/alias/email/id (create if not found)" with parameters
 +
 
 +
name=EXTRACT:BODY:Organization:\s*([\w\-\s]+)$
 +
email=EXTRACT:BODY:Email:\s*([\w\.\-]+@[a-zA-Z\.\-]+)
 +
 
 +
If the received email has no know format, you can't reuse content of email to guess the company name. So only the sender email will be used.
 +
 
 +
Then set a second action that is "Create an opportunity" (no parameters).
 +
 
 +
So each time an email is received to sales@mycompany.com, or an answer is done, the user followsales@mycompany.com receive the email and the collector will use it to find existing thirdparty or will create it if not found, then will create the Project/opportunity attached to it.
    
=Boundary Value Analysis=
 
=Boundary Value Analysis=
    
===Use Cases===
 
===Use Cases===
 +
The following use cases were tested for some version of Dolibarr and mail providers:
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
!Use Case
 
!Use Case
Line 100: Line 160:     
===Filters===
 
===Filters===
 +
 +
Depending on your mailbox service, some filters may works or not. This is a summary of tests done with different email services. When your mail hoster does not support the filter, Dolibarr may use the PHP to have filter working despite of this. But this is not always implemented.
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|+
 
|+
!Filters
+
!Filters/Technology used to filter
 +
!Office365
 
!GMail
 
!GMail
!PHP
+
!Dolibarr+PHP
 
!Errors / Problems
 
!Errors / Problems
 
|-
 
|-
 
|From
 
|From
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|To
 
|To
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|Cc
 
|Cc
 +
|
 
|KO
 
|KO
|
+
|?
 
|Search string not understood - Unknown search criterion: CC
 
|Search string not understood - Unknown search criterion: CC
 
|-
 
|-
 
|Bcc
 
|Bcc
 +
|
 
|KO
 
|KO
|
+
|?
 
|Search string not understood - Unknown search criterion: BCC
 
|Search string not understood - Unknown search criterion: BCC
 
|-
 
|-
 
|ReplyTo
 
|ReplyTo
|Ignored
+
|
|KO @FIXME
+
|NA
|Works every time even if the Reply to string isn't in the mail
+
|Filter support with Dolibarr 20+
 +
|
 
|-
 
|-
 
|Subject
 
|Subject
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|Body
 
|Body
 +
|
 
|OK
 
|OK
 +
|'''NA'''
 
!
 
!
 +
|-
 
!
 
!
|-
   
!
 
!
 
!
 
!
Line 148: Line 220:  
|-
 
|-
 
|Already read
 
|Already read
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|Unread
 
|Unread
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|Unanswered
 
|Unanswered
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|Answered
 
|Answered
 +
|
 
|OK
 
|OK
!
+
|'''NA'''
 
!
 
!
 
|-
 
|-
 
|Size (Smaller than)
 
|Size (Smaller than)
 +
|
 
|KO
 
|KO
|
+
|'''NA'''
 
|Search string not understood - Unknown search criterion: SMALLER
 
|Search string not understood - Unknown search criterion: SMALLER
 
|-
 
|-
 
|Size (Larger than)
 
|Size (Larger than)
 +
|
 
|KO
 
|KO
|
+
|'''NA'''
 
|Search string not understood - Unknown search criterion: LARGER
 
|Search string not understood - Unknown search criterion: LARGER
 
|-
 
|-
 
|Message from a conversation initiated by a first email sent from Dolibarr
 
|Message from a conversation initiated by a first email sent from Dolibarr
 +
|
 +
|'''NA'''
 
|OK
 
|OK
!
   
!
 
!
 
|-
 
|-
 
|Message from a conversation initiated by a first email NOT sent from Dolibarr
 
|Message from a conversation initiated by a first email NOT sent from Dolibarr
 +
|
 +
|'''NA'''
 
|OK
 
|OK
!
   
!
 
!
 
|-
 
|-
 
|Message sent from Dolibarr
 
|Message sent from Dolibarr
 +
|
 +
|'''NA'''
 
|OK
 
|OK
!
   
!
 
!
 
|-
 
|-
 
|Message NOT sent from Dolibarr
 
|Message NOT sent from Dolibarr
 +
|
 +
|'''NA'''
 
|OK
 
|OK
|
   
|Message not processed but not an error
 
|Message not processed but not an error
 
|-
 
|-
 +
!
 
!
 
!
 
!
 
!
Line 203: Line 286:  
|-
 
|-
 
|Is not answer (initial email)
 
|Is not answer (initial email)
|NA
+
|
!OK
+
|'''NA'''
 +
|OK
 
!
 
!
 
|-
 
|-
 
|Is an answer of an initial email
 
|Is an answer of an initial email
|NA
+
|
!OK
+
|'''NA'''
 +
|OK
 
!
 
!
 
|-
 
|-
 
|}
 
|}