Important

You are browsing upcoming documentation for version 6.1 of OroCommerce, scheduled for release in 2025. Read the documentation for version 6.0 (the latest LTS version) to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Usage Example 

// Preparing connection config
$imapConfig = new ImapConfig('imap.gmail.com', 993, 'ssl', 'user', 'pwd');

// Accessing IMAP connector factory
/** @var ImapConnectorFactory $factory */
$factory = $this->get('oro_imap.connector.factory');

// Creating IMAP connector for the ORO user
$imapConnector = $factory->createImapConnector($imapConfig);

// Creating IMAP manager
$imapManager = new ImapEmailManager($imapConnector);

// Creating the search query builder
$queryBuilder = $imapManager->getSearchQueryBuilder();

// Building a search query
$query = $queryBuilder
    ->from('test@test.com')
    ->subject('notification')
    ->get();

// Request an IMAP server for find emails
$imapManager->selectFolder('INBOX');
$emails = $imapManager->findItems($query);

// Creating IMAP folder manager
$imapFolderManager = new ImapEmailFolderManager($imapConnector);

// Getting IMAP folders
$folders = $imapFolderManager->getFolders(null, true);