Configuring an Incoming Mailbox
To be able to create entities, from incoming emails, it is necessary to define an incoming mailbox, and then associate this mailbox to related email rules.
This guide will explain how to configure an IN mailbox.
Important Note: based on the settings of your email server, all incoming messages could be deleted after Deepser has processed them. This is the default behaviour of the software with email servers like Exchange, Standard SMTP Servers, etc.
Be very careful when configuring the incoming email integration, do a test and a backup. Remember also that Deepser processes all the emails in the inbox, so if the mailbox is full of messages (eg: the first time we run the integration) a lot of records could be created.
To avoid this situations, not directly caused by Deepser, we advise always to do a test on mailboxes with few messages.
To configure a mailbox within Deepser, in the backend navigation menu, navigate to the System->Tools->Email->Mailbox section.
The grid in this section shows already configured mailboxes.
To configure a new mailbox click on the ‘+ Add Mailbox‘ button in the top right corner.
At this point the mailbox configuration form will appear.
Once the mailbox type has been set, in this case ‘IN‘, all the relevant fields will be loaded dynamically.
The fields in the form have the following meaning:
|GENERAL DATA||Name||Name of the mailbox. It is the name used in the select-boxes.|
|Type||IN o OUT (IN to receive emails, OUT to send).|
|Status||If “Disabled” the integration will not be considered by the system.|
|Host||Address of the mailserver.|
|Port||Port for the connection to the mailserver.|
|Encryption||Encryption of the connection..|
|Username||User name to read the mailbox (usually it is the email or the Exchange user associated to that mailbox).|
|Password||Password to login to the mailbox.|
|Protocol||Protocol to get the emails (POP3, IMAP or OWA).|
|OAuth Client||OAuth2 client used for the authentication, if required.|
|SITEMA DATA||Model||The field Model represents the entity of Deepser in which to look for a record linked to the received emails. If we set for example DeepService – Operation the mailbox will create and update records of Operations. If we set DeepAdmin – User the emails will used to create or update users.|
|Model Field||It is the field of the entity Model where to check if a record already exists. If we set the ID (field: entity_id), then the check will be done on entity_id (unique ID) of the Operations.|
|Prefix||It’s the prefix we prepend to the Model Field, to search the record. If we set the Model Field equals entity_id of the Operation, then the email integration verifies the subject of the email: if after the Prefix there’s an ID of a record already in the system. After the expression Prefix and until the first blank space, the ID of the model will be searched. Thus, if we set the field Prefix with the value TICKET# and the Model Field with the value entity_id, if we receive an email with subject TICKET#70, then Deepser looks for an Operation with ID 70. If Deepser finds that record, then the record is updated and the rules applyed to update the record are that in the Update Expression field. If we receive an email with a subject Hey this is a new ticket then Deepser creates a new record, following the rules in the field Create Expression.|
|Outgoing Email Box||We can teel the system that for every record created using this mailbox we will use the specific outgoing mailbox to send notifications.|
|Apply Email Rules||If yes related email rules are executed.|
|Allowed Emails||If we can receive email from all emails or only from registerd users. Ignored mails will be deleted.|
|Spam Expression||In this field it’s possible to define a regular expression to check the objects of incoming mails in case they should be identified as spam. If the emails are ignored they are deleted from the inbox.|
|ADVANCED||Cron Expression||Cron Expression that defines the frequency of the scan of Deepser. If this expression is not set, this mailbox will not be processed by Deepser.|
|Processed on||Date and time of the last scan of the mailbox.|
|Custom Code||PHP custom code run after the email has been received. It is possible to configure this field to trigger custom events after the email has been received. For example, if we want to receive a counter of the reminders or to update a specific entity of Deepser after we have received the email, we can customize this field to do that.|
Once the form has been filled and the configuration saved, click on the ‘Check‘ button, top right, to test the configuration.
If the mailbox has been configured correctly you will see a message of successful connection, otherwise an error message.