Email Archiving
Starting with the Zurmo 0.6.80 release, the email archiving feature has been integrated in the system. The aim of this tutorial is to give you enough information so you can start to use or hack email archiving.
The idea behind this feature is to allow users to archive emails into Zurmo CRM. This can be done by sending emails to the Zurmo Dropbox email account. The Zurmo Dropbox email account is same for all users of the system. The system links the email to a user (as well as contact/lead/account) by parsing the email address that was sent to the Zurmo Dropbox. If there is no email match in the system, the email will be returned to the user, with a message explaining the issue.
We can consider two cases here:
1. When a user sends an email to another user, and wants to archive it, you just need to add the Zurmo Dropbox email address to the BCC field.
2. When a user wants to archive an email from another user into Zurmo, you need to forward the email to the Zurmo Dropbox.
Cronjob must be set up to pull new emails from the Zurmo Dropbox IMAP server. During every run, Zurmo will try to match the email to existing contacts, leads, accounts and users. In case #1, this will be done by parsing the To and CC fields from the email message. In case #2, this will be done by parsing the text that is prepended to the email message, when you hit the forward button in your email client.
Zurmo Email Archiving settings can be set up via the admin area (Settings->Email Configurations->Email Archiving Configuration):
You must have access to the system settings in order to configure this system-wide setting. Once you enter your IMAP settings, click the Test button to ensure they are correct and working. If so, hit “Save” to store the settings.
We paid a good amount of attention to the unit tests for the email archiving feature, in order to ensure that the server is able to send emails and retrieve them from the IMAP server. Therefore, after you run your unit test for the first time, the perInstanceTest.php file will be created, and you will need to create three email accounts on your email server for test purposes. Here is example how these settings should look like:
$emailTestAccounts = array(
'smtpSettings' => array(
'outboundHost' => 'mail.example.com',
'outboundPort' => '25',
'outboundUsername' => 'dropbox@example.com',
'outboundPassword' => 'yourPassword',
'outboundSecurity' => false,
),
'dropboxImapSettings' => array(
'imapHost' => 'mail.example.com',
'imapUsername' => 'dropbox@example.com',
'imapPassword' => 'yourPassword',
'imapPort' => '143',
'imapSSL' => '',
'imapFolder' => 'INBOX',
),
'userImapSettings' => array(
'imapHost' => 'mail.example.com',
'imapUsername' => 'steve@example.com',
'imapPassword' => 'yourPassword',
'imapPort' => '143',
'imapSSL' => '',
'imapFolder' => 'INBOX',
),
'userSmtpSettings' => array(
'outboundHost' => 'mail.example.com',
'outboundPort' => '25',
'outboundUsername' => 'steve@example.com',
'outboundPassword' => 'yourPassword',
'outboundSecurity' => false
),
'testEmailAddress' => 'john@example.com',
);
If you want to run tests with Gmail account, your settings need to look like(please note that you will need 4 Gmail accounts):
$emailTestAccounts = array(
'smtpSettings' => array(
'outboundHost' => 'smtp.gmail.com',
'outboundPort' => '465',
'outboundUsername' => 'TEST_EMAIL_1@gmail.com',
'outboundPassword' => '********',
'outboundSecurity' => 'ssl',
),
'dropboxImapSettings' => array(
'imapHost' => 'imap.gmail.com',
'imapUsername' => 'TEST_EMAIL_2@gmail.com',
'imapPassword' => '********',
'imapPort' => '993',
'imapSSL' => true,
'imapFolder' => 'INBOX',
),
'userImapSettings' => array(
'imapHost' => 'imap.gmail.com',
'imapUsername' => 'TEST_EMAIL_3@gmail.com',
'imapPassword' => '********',
'imapPort' => '993',
'imapSSL' => true,
'imapFolder' => 'INBOX',
),
'userSmtpSettings' => array(
'outboundHost' => 'smtp.gmail.com',
'outboundPort' => '465',
'outboundUsername' => 'TEST_EMAIL_3@gmail.com',
'outboundPassword' => '********',
'outboundSecurity' => 'ssl',
),
'testEmailAddress' => 'TEST_EMAIL_4@gmail.com',
);

