Module EMail Collector

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
EMailCollector
Numero/ID of module 50320
User doc. of module This page
Developer doc. of module Module EMail Collector (developer)

Introduction

This module permits to collect emails from a mailbox using the IMAP protocol and record event or data in your Dolbarr using information found into email.

Installation

This module is included with the Dolibarr distribution, so there is no need to install it.

Setup

To use this module, you must first enable it using an administrator account, via the menu option "Home - Setup - Modules".

Choose the tab where the module is listed. Then click on "Activate".

The module is now activated.

If a cog icon appears Cog circle.svg on module thumb or at end of the line of the module, click on it to access the setup page specific to the module.


If available, it is recommended to enable the option "Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allows the use of an OAuth2 connection for IMAP (module OAuth must also be activated)." so when creating an email collector, you will be able to choose between IMAP login with user/pass or with an OAuth2 token.


Create an email collector

Create as many email collectors you need.

Host of email IMAP server: Enter the full name of the IMAP server. Exemple: imap.gmail.com

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.

Authentication mode

  • If you choose "Password", you must set an IMAP login and password.
  • If you choose "OAuth2", you must set the IMAP login and set the OAuth2 entry to use into the field Oauth service. To create your OAuth2 entry and choose the correct permission for this entry see documentation of Module OAuth

Source directory

  • To collect received email, enter here "INBOX"
  • To collect email sent, enter here "Sent"

Target directory A good practice is to move the collected email into another folder to avoid to have them collected twice. You must create the output target IMAP directory manually before running your email collector.

For example, with Gmail, to create a new IMAP directory:

  • Sign in to your Gmail account.
  • At the top right of the Gmail window, click Settings See all settings.
  • Click Labels.
  • Create Label and check the box "Show in IMAP"

Filters

Choose criteria to define which email is qualified for the collect.

Operations to do

Choose the action to do on collected emails.

Usage

Let the job scheduler being executed automatically 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. 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.

Boundary Value Analysis

User Stories

Story KO / OK Errors / Problems
Collect received mails (created from scratch by someone) OK
Collect email you sent from the "Email sent", by your email client, to someone. OK
Send email from Dolibarr (example from the backoffice for a ticket) and don't collect it from the "Email sent" because it may be a double: When the email sent and saved from Dolibarr is also saved into the "Emails sent", we must not re-import it. OK
Collect and link email received to ticket already created after we have sent a reply email and the customer responds on email address. KO Problem : The email is not linked to ticket and another ticket is created

Filters

Filters KO / OK Errors / Problems
From OK
To OK
Cc KO Search string not understood - Unknown search criterion: CC
Bcc KO Search string not understood - Unknown search criterion: BCC
ReplyTo OK Works every time even if the Reply to string isn't in the mail
Subject OK
Body OK
Already read OK
Unread OK
Unanswered OK
Answered OK
Size (Smaller than) KO Search string not understood - Unknown search criterion: SMALLER
Size (Larger than) KO Search string not understood - Unknown search criterion: LARGER
Message from a conversation initiated by a first email sent from Dolibarr OK
Message from a conversation initiated by a first email NOT sent from Dolibarr OK
Message sent from Dolibarr OK
Message NOT sent from Dolibarr OK Message not processed but not an error
Is not answer (initial email) OK
Is an answer of an initial email OK