Failed to connect to Exchange

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Failed to connect to Exchange

Post by horizn »

Hi,
I am trying to configure EmailReporting plugin, but plugin is not able to log in to MS Exchange server:

Code: Select all

# /usr/bin/php /var/www/mantis/plugins/EmailReporting/scripts/bug_report_mail.php
Start checking all mailboxes: Tuesday 3rd of February 2015 09:21:50

Mailbox: Helpdesk
Message: Failed to connect to the mail server

Done checking all mailboxes
no matter which type of authentication has been chosen.
I think the problem is because our Exchange configuration. The only supported authentication type are Password, NTLM/SPA and GSSAPI.
I tried all available authentication types on EmailReporting plugin config but with no result.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

Then enable plaintext authentication

Also what version are you running of EmailReporting? Recently there have been modifications in IMAP for exchange. Before that IMAP for exchange servers was not functional

Authentication failure would not fail the connection in most situations, you should have had a login failure
horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Re: Failed to connect to Exchange

Post by horizn »

recent downloaded from GIT yesterday. I've tried PLAIN as well, however I'll try to check Exchange logs.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

i mend enable plaintext authentication on exchange.

I suggest testing the pop3 using telnet
http://support.microsoft.com/kb/187785
http://www.yuki-onna.co.uk/email/pop.html

Are you sure a firewall isn't blocking your connection?
Last edited by SL-Gundam on 05 Feb 2015, 17:05, edited 1 time in total.
horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Re: Failed to connect to Exchange

Post by horizn »

Hi,
We don't have POP support, only IMAP. However I've checked IMAP logs on CAS server and I found only:

Code: Select all

2015-02-05T13:34:44.779Z,0000000000000007,0,10.171.3.23:993,10.171.22.10:41420,,-2147483648,0,53,OpenSession,,
2015-02-05T13:34:44.795Z,0000000000000007,1,10.171.3.23:993,10.171.22.10:41420,,0,0,0,CloseSession,,
no matter what kind of authentication is used. I've tried domain\username, username@domain, username, etc. as login.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

Check the authentication settings on the IMAP service in exchange

It should be setup like this so that we can check things easier:
Image

If needed we can enable secure logon later but first we need to get EmailReporting to work
horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Re: Failed to connect to Exchange

Post by horizn »

I've checked it on external mail server based on DoveCot/Exim, and it is not working with IMAP but it is working with POP3:

Code: Select all

Feb 10 14:57:21 lan dovecot: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=mantis_ip, lip=server_ip, TLS, session=<yK4LRLwOiwA+6Jw8>
Feb 10 14:58:47 lan dovecot: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=mantis_ip, lip=server_ip, TLS, session=<17MkSbwOlgA+6Jw8>
Feb 10 15:00:22 lan dovecot: pop3-login: Login: user=<mantis@domain>, method=PLAIN, rip=mantis_ip, lip=server_ip, mpid=8433, TLS, session=<oKzMTrwOCgA+6Jw8>
Feb 10 15:00:22 lan dovecot: pop3(mantis@domain): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
and how it looks when Thunderbird is used as a client:

Code: Select all

Feb 10 15:10:11 lan dovecot: imap-login: Login: user=<mantis@domain>, method=PLAIN, rip=mantis_ip, lip=server_ip, mpid=8518, TLS, session=<kuHrcbwO2gA+6Jw8>
Feb 10 15:10:12 lan dovecot: imap(mantis@domain): Disconnected: Logged out in=8 out=395
definitely is not a server problem.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

If you want to make sure it is not the server try using telnet towards the server. If that works without issues then EmailReporting should work as well. If EmailReporting does not work and telnet does then there is a problem with EmailReporting

POP3 - telnet
http://support.microsoft.com/kb/187785
http://www.yuki-onna.co.uk/email/pop.html

IMAP - telnet
http://support.microsoft.com/kb/189326
http://www.yuki-onna.co.uk/email/imap.html

telnet with IMAP might be a bit finicky.

While your trying that, please provide me with the mailbox configuration (ports, encryption stuff like that)
horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Re: Failed to connect to Exchange

Post by horizn »

So I've tried IMAP (no encryption) via telnet:

Code: Select all

* OK The Microsoft Exchange IMAP4 service is ready.
A login helpdesk@domain password
A OK LOGIN completed.
B select INBOX
* 1 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Perman
ent flags
* OK [UNSEEN 1] Is the first unseen message
* OK [UIDVALIDITY 344678] UIDVALIDITY value
* OK [UIDNEXT 5] The next unique identifier value
B OK [READ-WRITE] SELECT completed.
and using bug_report_mail.php (without encryption):

Code: Select all

php /var/www/mantis/plugins/EmailReporting/scripts/bug_report_mail.php
Start checking all mailboxes: Wednesday 11th of February 2015 09:26:49



Mailbox: Helpdesk
Location: Attempt login
[pear_error: message=", " code=0 mode=return level=notice prefix="" info=""]


Done checking all mailboxes
Our exchange imap server is server.domain.com
our active directory domain is: domain
I can login to OWA using: username@domain.com or domain\username and password.

brgds,
kamil
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

Which version of Exchange are you using?

Could you provide the complete setup of the mailbox in EmailReporting? (debug dump or screenshot)

Do you have an installation of local pear packages? EmailReporting provides its own but local pear packages take precedence over the ones provided with EmailReporting
horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Re: Failed to connect to Exchange

Post by horizn »

SL-Gundam wrote:Which version of Exchange are you using?

Could you provide the complete setup of the mailbox in EmailReporting? (debug dump or screenshot)

Do you have an installation of local pear packages? EmailReporting provides its own but local pear packages take precedence over the ones provided with EmailReporting
Didn't know that. How can I check is it ok or not?

screenshot:
Image
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

alright what version of exchange do you have?

You would know if you had a local pear repository installed
horizn
Posts: 19
Joined: 03 Feb 2015, 09:07

Re: Failed to connect to Exchange

Post by horizn »

Exchange 2010. pear list:

Code: Select all

# pear list
Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.3.7   stable
Benchmark        1.2.8   stable
Console_Getopt   1.2.3   stable
Mail             1.2.0   stable
Mail_Mime        1.8.1   stable
Mail_mimeDecode  1.5.5   stable
Net_SMTP         1.6.0   stable
PEAR             1.9.1   stable
Structures_Graph 1.0.3   stable
XML_Util         1.2.1   stable
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

I think everything should have worked. But it doesn't so... i'm stumped

The telnet tests you did towards imap, were they from the webserver where EmailReporting is running? or from another machine?

Have you tested the mailbox through the running of bug_report_mail.php and through using the mailbox test feature?
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Failed to connect to Exchange

Post by SL-Gundam »

If so, i am curious what the cause of the issue was
Post Reply