Author Topic: Feng Office Imap and Exchange 2007 - no email retrieval...  (Read 10162 times)

martinpluss

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Feng Office Imap and Exchange 2007 - no email retrieval...
« on: August 24, 2010, 04:07:48 pm »
Ladies and Gents,

I REALLY need help with this. Brand new to FengOffice. Just installed it (1.7) on an already working IIS6/PHP/MySQL box and to double check I also have a brand new Ubuntu Server 10.04 LAMP installation with Feng Office 1.7 installed.

I have spent the past two days tearing my hair out trying to get Feng Office to collect email using imap from My Exchange 2007 server. It connects fine and doesn't present any errors - it just says 'Success'  '0 emails received'.

Nothing I have tried works. I know the Imap service is there and working as I can connect to the mail server using Mozilla Thunderbird. Thunderbird is connecting to the mail server using SSL/TLS connectivity security (port 993) and 'Normal Password' as the Authentication method.

Now, I have been reading about imap_php module incompatibility with Exchange 2007 - apparently Exchange 2007 has a bug where it advertises Kerberos/GSSAPI even when its not enabled (it isn't) and so the imap_php module (which defaults to Kerberos auth) can connect to the server but can't retrieve email.

Feng Office seems to use its own imap PEAR module (rather than imap_php.so/dll), but I'm wondering if it has a similar 'default to kerberos auth' issue?

Is there anybody out there with Feng Office happily collecting email via imap from an Exchange 2007? If so please please please can you tell me how you did it?

If not, anybody have any ideas as to how I can fault find this?

Thanks,

Martin

martinpluss

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #1 on: August 24, 2010, 09:02:40 pm »
An Update:
It looks like my original hypothesis could have been wrong. I have been testing this imap issue some more and have made the following discoveries:

Yes the Exchange 2007 server is announcing GSSAPI as being available, however if I change that (by daisy chaining imap proxys and altering the headers) I still don't get access to my emails.

The FengOffice Imap Client sucessfully logins in and is advised that there is unseen emails in the inbox but for an unknown reason does not process these emails and does not display them in the email tab in Feng Office.

I will copy the output from my IMAP Proxy below so you can see what happens. Any ideas why the Imap client sends a LOGOUT command without downloading the emails?

Code: [Select]
25/08/10 00:53 - [-1] S <-- * OK IMAP4 Ready 10.12.60.73 0001db88
25/08/10 00:53 - [1] **** NEW CONNECTION (10.10.1.90)
25/08/10 00:53 - [1] C --> A0001 CAPABILITY
25/08/10 00:53 - [1] S <-- * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=PLAIN
25/08/10 00:53 - [1] S <-- A0001 OK CAPABILITY
25/08/10 00:53 - [1] C --> A0003 CAPABILITY
25/08/10 00:53 - [1] S <-- * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=PLAIN
25/08/10 00:53 - [1] S <-- A0003 OK CAPABILITY
25/08/10 00:53 - [1] C --> A0004 LOGIN "<---MyUSername--->" "<---MyPassword--->"
25/08/10 00:53 - [1] S <-- A0004 OK You are so in
25/08/10 00:53 - [1] C --> A0005 SELECT "INBOX"
25/08/10 00:53 - [1] S <-- * 34382 EXISTS
25/08/10 00:53 - [1] S <-- * 0 RECENT
25/08/10 00:53 - [1] S <-- * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
25/08/10 00:53 - [1] S <-- * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
25/08/10 00:53 - [1] S <-- * OK [UNSEEN 34378] Is the first unseen message
25/08/10 00:53 - [1] S <-- * OK [UIDVALIDITY 53] UIDVALIDITY value
25/08/10 00:53 - [1] S <-- * OK [UIDNEXT 38210] The next unique identifier value
25/08/10 00:53 - [1] S <-- A0005 OK [READ-WRITE] SELECT completed.
25/08/10 00:53 - [1] C --> A0006 LOGOUT
25/08/10 00:53 - [1] S <-- * BYE Microsoft Exchange Server 2007 IMAP4 server signing off.
25/08/10 00:53 - [1] S <-- A0006 OK LOGOUT completed.
25/08/10 00:53 - [1] **** CONNECTION TERMINATED in 2828 ms.

martinpluss

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #2 on: August 25, 2010, 07:04:50 pm »
Another update:
OK. I have proven that I can access my exchange mail server using imap_open function through an imap proxy (that removes the GSSAPI advertisement) from the same server that FengOffice is installed on using the following code:

Code: [Select]
<?php

$mail_server 
"10.10.1.90" ;
$mail_port 143 ;
$mail_username "<mytestusername>" ;
$mail_password "<my password>" ;

echo 
"<h1>".$mail_username." on ".$mail_server."</h1>\n\n" ;
$mbox imap_open("{".$mail_server.":".$mail_port."}".$mail_folder$mail_username$mail_password) or die("Error opening mailbox: ".imap_last_error());
$mailboxheaders imap_headers($mbox);
if (
$mailboxheaders == false) {
    echo 
"<p>".$mail_folder." is empty.</p>\n\n";
    }
else {
    echo 
"<h2>".$mail_folder."</h2>\n" ;
    echo 
"<ol>\n" ;
    
$msgno 0;
    foreach (
$mailboxheaders as $val) {
        
$msgno++;
        echo 
"  <li>".$val ."</li>\n";
        }
    echo 
"</ol>\n\n" ;
    }
imap_close($mbox);

?>


BUT... this only works with a test account with 4 emails in the inbox. MY main account (with 34k emails in the inbox) times out and I get a FastCGI error).

However I still can't receive email from my test account (with 4 emails)  in FengOffice using the exact same details as I am using with imap_open above... so it can't be just a mailbox size issue...

Please somebody - help make this go away!! ;-)

martinpluss

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #3 on: August 28, 2010, 12:40:51 pm »
Hooray. I can now finally connect directly to our exchange 2007 server.
I passed the problem over to our resident in house php rocket scientist Pete C, who after a couple of hours of fault finding, discovered the cause of the problem.

Instead of returning a list of mail boxes straight away the exchange 2007 box first sends a load of junk (mainly spaces). Pete edited the imap.php and imapprotocol.php and filtered out the junk using if statements and bobs your uncle we now have imap email in Feng Office!!

How all I have to do is configure FO for our departments use ;-)

martinpluss

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #4 on: August 28, 2010, 01:32:16 pm »
Here is the IMAPProtocol.php file we are now using that works. We have made two 'While' command additions to the code. If you Search for 'Peter Chaplin' you find them. Do let me know if this helps you as well. I'd be interested to find out if this is just an exchange 2007 problem...

franponce87

  • Administrator
  • Hero Member
  • *****
  • Posts: 1819
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #5 on: September 03, 2010, 01:53:26 pm »
Thanks for your contribution, we will have a look at it and check the code out
Would you like to install Feng Office Professional or Enterprise Edition in your servers? No problem! Read this article!

joeph

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #6 on: November 23, 2010, 02:35:09 pm »
Thanks martinpluss!!!!
Now we have mail in Feng!

franponce87

  • Administrator
  • Hero Member
  • *****
  • Posts: 1819
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #7 on: December 01, 2010, 10:03:04 am »
Thanks martinpluss!!!!
Now we have mail in Feng!
Actually there has been an email module since long ago  ::)
Would you like to install Feng Office Professional or Enterprise Edition in your servers? No problem! Read this article!

martinpluss

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #8 on: January 29, 2011, 08:35:46 pm »
@franponce87 - You're right, there has been an email module for ages but without this fix, imap collection doesn't work withe xchange 2007.

Just installed a new box (Feng Office 1.7.3.1) and it had exactly the same problem with no emails getting collected. the attached IMAPProtocol.php in this post fixes it though ;-)

franponce87

  • Administrator
  • Hero Member
  • *****
  • Posts: 1819
    • View Profile
    • Email
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #9 on: February 01, 2011, 10:41:01 am »
Yes, that is not what I actually meant heh.
We are aware of the fixes you have made,  and we greatly appreciate them, but we have been busy fixing other bugs lately and implementing tiny little features which were sort of a must, so we have not been able to fully test and implement what you have done yet.

Best regards!
Francisco
Would you like to install Feng Office Professional or Enterprise Edition in your servers? No problem! Read this article!

sim

  • Freshman
  • *
  • Posts: 13
    • View Profile
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #10 on: November 24, 2011, 04:08:09 pm »
@martinpluss: Thanks for the imap.zip.
It fixed my issue "no mails received" with Feng Office 1.7.5 connected to exchange 2010 via imap.

simonwenger

  • Freshman
  • *
  • Posts: 26
    • View Profile
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #11 on: December 15, 2011, 08:35:16 pm »
Yessss! Thank you very much! It took me a while to find this solution as I always believed it to be a problem with the IMAPS.
Now feng can take off! Cheers, S

feertman

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Feng Office Imap and Exchange 2007 - no email retrieval...
« Reply #12 on: June 17, 2014, 06:45:47 am »
Hi all,

We also have problems with configuring our exchange server. Can someone provide me the above-mentioned script please, as the file is not available any more? Thank you! Best regards, Frank