pear_error code=-1 when retrieving mail

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

Moderators: Developer, Contributor

cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

I have debugging enabled and it says the directory is found and writable, but I'm not getting anything in it.
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

I must have screwed something up trying to troubleshoot this because after deleting the messages that wouldn't get delivered now I can't get anything to be picked up. :x
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

I did a fresh install of PHP 5.4.1, Mantis 1.2.10, and EmailReporting 0.9.0-DEV and I'm still getting pear-error code=-1 no matter what e-mail I send. It's clearly something in my configuration but I have no clue what it might be, and there is nothing in any log that points me in a direction. Any ideas other than move on to another project and stop annoying you? :cry:
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: pear_error code=-1 when retrieving mail

Post by SL-Gundam »

I've made some small enhancements to error handling

Hopefully it will let us know where exactly the error occured.

Please download the latest version: https://github.com/mantisbt-plugins/EmailReporting
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

I'm rebuilding the server and will post here later today when I have everything reinstalled.
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

That went faster than I thought. The additional debugging was very helpful, thanks for your continued help and support.

Code: Select all

Start checking all mailboxes: Wednesday 9th of May 2012 09:03:14

Mailbox: INITIALIZATION PHASE
Message: Debug output memory usage
Location: Mail API - Finished __construct
Current memory usage: 5.1 MiB / -1
Peak memory usage: 5.19 MiB / -1
Current real memory usage: 5.25 MiB / -1
Peak real memory usage: 5.25 MiB / -1

Mailbox: Helpdesk mailbox
Message: Upload folder is not writable: C:/inetpub/wwwroot/helpdesk/uploads

Done checking all mailboxes
I created C:/inetpub/wwwroot/helpdesk/uploads and tried it again.

Code: Select all

Start checking all mailboxes: Wednesday 9th of May 2012 09:07:02

Mailbox: INITIALIZATION PHASE
Message: Debug output memory usage
Location: Mail API - Finished __construct
Current memory usage: 5.1 MiB / -1
Peak memory usage: 5.2 MiB / -1
Current real memory usage: 5.25 MiB / -1
Peak real memory usage: 5.25 MiB / -1

array(12) {
  ["enabled"]=>
  bool(true)
  ["description"]=>
  string(16) "Helpdesk mailbox"
  ["mailbox_type"]=>
  string(4) "POP3"
  ["hostname"]=>
  string(30) "chs-ofc-ex1.mydomain.com"
  ["port"]=>
  int(110)
  ["encryption"]=>
  string(4) "None"
  ["username"]=>
  string(23) "helpdesk"
  ["password"]=>
  string(12) "YWJjMTIzJA=="
  ["auth_method"]=>
  string(4) "USER"
  ["project_id"]=>
  int(12)
  ["global_category_id"]=>
  int(1)
  ["link_rules"]=>
  array(0) {
  }
}

Mailbox: Helpdesk mailbox
Message: Debug output memory usage
Location: Mail API - Start process mailbox
Current memory usage: 5.1 MiB / -1
Peak memory usage: 5.2 MiB / -1
Current real memory usage: 5.25 MiB / -1
Peak real memory usage: 5.25 MiB / -1

Mailbox: Helpdesk mailbox
Location: Attempt login
[pear_error: message="" code=-1 mode=return level=notice prefix="" info=""]

Mailbox: Helpdesk mailbox
Message: Debug output memory usage
Location: Mail API - Finished process mailbox
Current memory usage: 5.12 MiB / -1
Peak memory usage: 5.2 MiB / -1
Current real memory usage: 5.25 MiB / -1
Peak real memory usage: 5.25 MiB / -1

Done checking all mailboxes
I thought this might be telling me that it is unable to login, so I verified the username and password by connecting using Outlook just to make sure I wasn't going crazy, and the credentials work. I tried helpdesk with the domain as the username, with the same results. On the Exchange server I am not seeing any success or failure in the security log. I turned on all the account logging options on the Mantis server and when I run bug_report_mail.php nothing is getting logged.

I checked my firewall and was surprised to see this

Code: Select all

protocol=netbios-ns/udp, src_ip=10.1.1.145, src_port=59128, dst_ip=10.2.0.0, dst_port=137, src_intf=1-Trusted, dst_intf=Firebox, rc=101, pckt_len=78, ttl=128
I have no idea why it is trying to connect to 10.2.0.0 because the IP address of my Exchange server is 10.1.1.158. I replaced the hostname with the IP of my Exchange server and the firewall no longer reports an error, but it still didn't work. There is also still no entry in the security log of either the Exchange server or the server running Mantis showing the connection was attempted.

Any thoughts on what to try next?
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: pear_error code=-1 when retrieving mail

Post by SL-Gundam »

port 137 is used for netbios within a internal network. Normally used to convert a hostname into a ip address -> http://www.grc.com/port_137.htm

But since we now know what action is causing the error i suggest you try playing with the "Auth method" and "Encryption" settings for the mailbox in EmailReporting.

It might help fixing your problem
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

The only option I have for encryption is "PHP OpenSSL extension not available". I cycled through every authentication method. Some gave me [pear_error: message="Unknown Response ()" code=-1 mode=return level=notice prefix="" info=""], but none established a connection to the Exchange server. I can telnet from the Mantis server to Exchange and log in using the helpdesk credentials.
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

I'm a drooling moron. Someone shut down POP3 on our Exchange server and didn't tell me. Exchange was rejecting the connection which is why the authentication wasn't getting logged.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: pear_error code=-1 when retrieving mail

Post by SL-Gundam »

Thats still weird. A connection rejection or timeout should have happened then. It seems to me that the connection was made and immediatly closed outside of the standard pop3 protocol. I might improve this in future versions

But at least everyhting is working again. Please let me know if you still problems
cubert
Posts: 25
Joined: 23 Mar 2012, 19:53

Re: pear_error code=-1 when retrieving mail

Post by cubert »

One small point of correction: the POP3 service was running but the POP3 Virtual Server was not. Once I started the POP3 virtual server mail started flowing. According to the Wireshark capture I did the Exchange server reset the connection. I attached the capture in case you want to look at it. 10.1.1.158 is my Exchange server, 10.1.1.145 is the Mantis server. I had to rename it as a TXT file since CAP files aren't allowed.
Attachments
mantis_exchange.txt
Capture of Mantis to Exchange communication with POP3 service shut down on Exchange.
(842 Bytes) Downloaded 696 times
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: pear_error code=-1 when retrieving mail

Post by SL-Gundam »

alright

At least the problem is fixed. I'll probably just add some documentation about this in EmailReporting and i hope future pear packages will handle this better and hopefully the php imap package can already handle this
Post Reply