When Sugar® is configured to automatically import inbound emails (e.g. group inbound emails and bounce emails), the associated schedulers (e.g. “Check Inbound Mailboxes” or “Run Nightly Process Bounced Campaign Emails”) retrieve new emails from the active accounts specified in Admin > Inbound Email. The import process looks for emails marked as “unread”, imports them into Sugar, then marks them as “read”. A problem occurs, however, when a particular email cannot be imported, is therefore not marked as “read”, and Sugar cannot import other new emails even on subsequent scheduler runs because it continues attempting to import the problem email. The problem email essentially causes Sugar to get stuck.
To keep your instance importing new emails even when it meets a problem email (e.g. an email with an overly-large header), you can mark the new emails as “read” before Sugar attempts to import them. The result is that any problem email which would normally halt the import of other emails will simply be skipped over. Sugar will still fail to import the problem email, but since it was already marked as “read”, Sugar will move on to the emails following it the next time the scheduler runs. This article covers how to make a code-level customization which marks emails as “read” prior to importing them to Sugar.
Note: This article pertains to Sugar versions 7.5.x through 7.9.x.
- You will need direct access to the server in order to make the necessary changes in the file system. If you already have a relationship with a Sugar partner, you can work with them to make this customization. If not, please refer to the Partner Page to find a reselling partner to help with your development needs.
- An inbound email account must already be configured to import incoming emails. For more information on creating and configuring the inbound email account, please refer to the Email documentation.
- Schedulers, specifically “Check Inbound Mailboxes” and “Run Nightly Process Bounced Campaign Emails”, must be running. For more information, please refer to the Schedulers documentation.
Starting in Sugar 7.2, there is a configuration option that causes Sugar to mark emails as “read” prior to attempting to import them. It is important to note that enabling this option will cause any errant emails to be skipped by the scheduler and not imported into Sugar. Sugar will only attempt to import an email once, and if the import fails, it will be skipped over so as not to stall the import of other new emails.
Use the following steps to enable the option to mark emails as “read” before importing to Sugar:
- Open the
config_override.phpfile located in the root directory of your Sugar instance.
- Add the following line of code to the
$sugar_config['mark_emails_seen'] = true;
- The updated file should look similar to this:
- Save the file.
Once the appropriate change has been made, the emails on the mail server will now be marked as “read” prior to importing into Sugar. Going forward, any errant emails that are detected will not be imported into Sugar and will be skipped by the scheduler during the import process. The scheduler will then continue to run and import all subsequent emails accordingly without any interruptions.