If you have just upgrade Ubuntu from 12.04 to Ubuntu 14.04 and are running Kayako. You might have seens this bug:
Your PHP was not compiled with IMAP support.
The solution is to first install the php imap extension:
sudo apt-get install php5-imap
Then restart Apache using:
sudo apache2ctl restart
If you are still having the error then you need to explicitely enable this extension.
ln /etc/php5/conf.d/imap.ini /etc/php5/apache2/conf.d/20-imap.ini
Then finally restart Apache again:
sudo apache2ctl restart
Hope this help someone.