* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not * reasonably feasible for technical reasons, the Appropriate Legal Notices must * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". ********************************************************************************/ global $current_user; if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'personal') { if ($current_user->hasPersonalEmail()) { $ie = new InboundEmail(); $beans = $ie->retrieveByGroupId($current_user->id); if (!empty($beans)) { /** @var InboundEmail $bean */ foreach ($beans as $bean) { $bean->importMessages(); } } } header('Location: index.php?module=Emails&action=ListView&type=inbound&assigned_user_id=' . $current_user->id); } elseif (isset($_REQUEST['type']) && $_REQUEST['type'] == 'group') { $ie = new InboundEmail(); // this query only polls Group Inboxes $r = $ie->db->query('SELECT inbound_email.id FROM inbound_email JOIN users ON inbound_email.group_id = users.id WHERE inbound_email.deleted=0 AND inbound_email.status = \'Active\' AND mailbox_type != \'bounce\' AND users.deleted = 0 AND users.is_group = 1'); while ($a = $ie->db->fetchByAssoc($r)) { $ieX = new InboundEmail(); $ieX->retrieve($a['id']); $ieX->importMessages(); } header('Location: index.php?module=Emails&action=ListViewGroup'); } else { // fail gracefully header('Location: index.php?module=Emails&action=index'); }
function pollMonitoredInboxesForBouncedCampaignEmails() { Log::info('----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()'); global $dictionary; $ie = new InboundEmail(); $r = $ie->db->query('SELECT id FROM inbound_email WHERE deleted=0 AND status=\'Active\' AND mailbox_type=\'bounce\''); while ($a = $ie->db->fetchByAssoc($r)) { $ieX = new InboundEmail(); $ieX->retrieve($a['id']); $ieX->connectMailserver(); $ieX->importMessages(); } return true; }
public function testimportMessages() { $inboundEmail = new InboundEmail(); //execute the method and test if it works and does not throws an exception. try { $inboundEmail->protocol = 'pop3'; $inboundEmail->importMessages(); $this->assertTrue(true); } catch (Exception $e) { $this->fail(); } }