Tuesday, 10 November 2009

SugarCRM (Automatic Retrieval of Emails)

Another issue encountered about the efficiency of the standard CRM application. Users has to check for any new emails manually. Any email client should do it automatically, however Sugar CE didn't. I updated the latest patch and currently using 5.2.0K version. I researched for this problem and found a tweak for the cron job for php files. The instructions on several different tech forums were not very clear therefore I am mentioning exactly what I did: -
In Windows: -
Initially set-up a batch file and add that batch file to the windows scheduler.
1. To create a batch file in Windows, open notepad.exe, copy & paste the what Sugar tells you to into a blank file. here is what - just copy and paste this php code: -
cd C:\Program Files\sugarcrm-5.2.0k\htdocs\sugarcrm\
"C:\Program Files\sugarcrm-5.2.0k\php\php-cgi.exe" -c "C:\Program Files\sugarcrm-5.2.0k\php\php.ini" -f "C:\Program Files\sugarcrm-5.2.0k\htdocs\sugarcrm\cron.php"

Now save this notepad as crmcron.bat and When saving, and this is VERY important, change the Save As Type: dropdown to All Files *.*. Give it any name you want, but make sure the extension is .bat. Test it by double-clicking the batch and making sure you pull down some emails from your inbox.
Now go to the Scheduler screen through Admin -> Schedulers. At the bottom of the default screen, you will see the contents of the commands you need to add to a batch file. Just add the created crmcron.bat file to this schedule and schedule it to run every minute daily for 24 hours from midnight (this is very important). And bingo, the CRM application started checking for newly arrived emails automatically.

SugarCRM (POP3 vs. IMAP): -

Further Email Problems

The email was set-up with POP3 protocol settings which worked quite well for couple of months but recently users started complaining about emails been lost, arriving with a backlog of up to 90 minutes, and not getting deleted properly.
The first thing was to check our email server whether it was receiving the emails at all and if it was then at what time (to check the backlog). The server raw header stated the emails arrived into the email server at correct time and was delivered to the accounts without any delay which proved there was no problem from the server side. Nevertheless, I found there was time delay only if the emails where sent to the CRM accounts. Therefore, we came to a conclusion that the problem might exist the way CRM application was pulling the emails from the email server.
After checking the email settings I found the server protocol was set-up as POP3 and that gave another clue of checking and testing another resolution which was IMAP. I did some goggling over it (as we are using the community edition for which there is no support provided) and discovered there is indeed some issues with sugar on pop3 settings. Afterwards I contacted a support person in Dublin whom I met in the SugarCRM Acceleration summit in London and he kindly agreed to answer few of my questions. He too confirmed the same problems I found during my self-research.
I have been testing the trial and error method on my development version to see if the switch protocol to IMAP makes any effect to the email efficiency. The difference was easily noticeable. The email sent and received responded instantly on IMAP settings. Therefore, the problem of messed email inbox seemed resolved because in imap protocol the client takes a copy of the email and leave the original on the server which later on another client can copy too. Therefore, no lost emails.
The steps were quite straightforward. Just log-into CRM, go to email > then email settings > select the account you want to edit > change the server protocol to IMAP and monitor inbox, sent and trash folders. Save and do a test which completed successfully for me.