Email Parser: IMAP Mail Queues with Microsoft Exchange

Discussion in 'Installation, setup, upgrading and importing' started by Matt Muller, Aug 9, 2012.

  1. Matt Muller New Member

    Just downloaded and installed Kayako Resolve and went to set up IMAP email importing from our Exchange server. Whenever I tested the connection, I'd get the message Kerberos error: No credentials cache found (try running kinit) and the connection would fail.

    A little bit of Googling showed me that I wasn't the first person to experience this problem. Thanks to Technocrat and chrismorley, multiple Red Bulls, and a couple hours of pulling my hair out, I was able to get IMAP email import working on CentOS 6.3 x64 running PHP 5.3.3. If anyone running the same system wants the imap.so module for Apache, just let me know and I'd be happy to send it over. If you want to do it yourself, the instructions are below. I'm assuming that you're running a standard CentOS 64-bit install and everything is in default locations.

    First, you'll want to make sure you have all the necessary dependencies installed on your system. (Adding the EPEL repo is generally useful if you don't have it already):


    Code:
    wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
    rpm -ivh epel-release-6-7.noarch.rpm
    yum groupinstall "Development Tools"
    yum install openssl-devel pam-devel libxml2-devel

    Next, you'll want to download the latest IMAP c-client and get that ready to compile:

    Code:
    cd /usr/local
    wget ftp://ftp.cac.washington.edu/imap/c-client.tar.Z
    tar -xzf c-client.tar.Z
    rm -f c-client.tar.Z
    cd imap-2007f
    ln -s /usr/lib64/openssl/engines/ /usr/local/ssl
    ln -s /usr/include/ /usr/local/ssl/include
    export CPPFLAGS=-DOPENSSL_NO_KRB5
    Because this is a 64-bit system, you'll also want to edit the Makefile or you'll get an error down the road. Find the line that reads 'EXTRACFLAGS=' and change it to

    Code:
    EXTRACFLAGS=-fPIC
    Now you'll actually compile the c-client and move the components into their correct locations - hooray, we're like almost halfway done!

    Code:
    make lr5
    mkdir lib
    mkdir include
    cp c-client/*.c lib/
    cp c-client/*.h include/
    cp c-client/c-client.a lib/libc-client.a
    Now it's time for the PHP portion of this (don't forget to download the version of PHP that you're running):

    Code:
    cd ~
    wget http://museum.php.net/php5/php-5.3.3.tar.gz
    tar -xzf php-5.3.3.tar.gz
    cd php-5.3.3
    ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --without-kerberos --with-imap=shared,/usr/local/imap-2007f/ --with-imap-ssl
    make
    Hopefully there were no errors - if there are, it's probably related to a missing library. The last step is to swap out the existing IMAP module with the one you just compiled and restart Apache for it to take effect:

    Code:
    cp /usr/lib64/php/modules/imap.so ~/imap.so.bak
    cp modules/imap.so /usr/lib64/php/modules/imap.so
    service httpd restart
    Hope that helped. Ultimately it took many, many hours, a lot of pain, and the following resources (who I am infinitely indebted to) to make this work.

    http://forums.kayako.com/threads/fix-kerberos-error-on-email-parser.29626/
    http://forums.kayako.com/threads/es...p3-mails-are-not-downloaded.16717/#post-87530
    http://php.rinet.ru/manual/en/ref.imap.php#103585
    http://jehiah.cz/a/compiling-shared-php-modules
    http://www.directadmin.com/forum/showthread.php?t=41879&page=1
    Gary McGrath likes this.

Share This Page