Synchronization with IMAP Servers
To synchronize personal emails using the Oro application, users must configure their IMAP mailbox on the user details page. The required information is the host, port, security type, and credentials for the IMAP integration.
During the synchronization, the Oro application loads emails from the user’s inbox and outbox folders using the following algorithm:
- If their mailbox is synchronized for the first time, the Oro application loads only the emails sent and received in the past year.
- Only emails in the folders that are enabled for synchronization in the User Configuration settings are synchronized. To check the settings, click My Configuration under your name on the top right on the back-office, and navigate to System Configuration > General Setup > Email Configuration >Email Synchronization Settings.
- When an empty folder is deleted from the email server, it gets deleted in the Oro application during the synchronization via IMAP. Folders with the existing emails that have already been synchronized remain intact and are kept by Oro.
- When the synchronization settings change, folders are synchronized automatically, but not the emails.
By default, the synchronization is executed by a CRON job every minute. You can launch synchronization manually using the following command:
php bin/console oro:cron:imap-sync
Email synchronization functionality is implemented in the following classes:
- ImapEmailSynchronizer - extends OroEmailBundle\Sync\AbstractEmailSynchronizer class to work with IMAP mailboxes.
- ImapEmailSynchronizationProcessor - implements email synchronization algorithm used for synchronizing emails through IMAP.
- EmailSyncCommand - allows executing email synchronization as a CRON job or through the command line.
When during the synchronization, the mailbox IMAP connection settings become invalid for any reason, the mailbox owner is notified using the following channels:
- After a successful login to the Oro application, the mailbox owner receives a notification via a flash message.
- If the clank server is turned on, the user receives messages about the issue.
- Oro application sends an email to the owner’s email address.
For the system mailboxes that have no owner, there is an oro_imap_sync_origin_credential_notifications capability. Users of any role with this capability enabled, are notified using the channels mentioned above.