You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2008-10-30 03:01:43

jpalmer99
Member
Registered: 2008-08-29
Posts: 17

Mail Gateway - Connection Failed - PHP Error

I am trying to setup the Mail Gateway and getting the following error when turning on GLPI debug testing:

PHP Error: imap_open() [function.imap-open]: Couldn't open stream {192.168.140.65/pop} in /var/www/html/glpi/inc/mailgate.class.php at line 461

This is the connection parameter:

{192.168.140.65/imap/novalidate-cert}


I get the same error when using POP as well.  I am not sure how to enable to logs so that I can look at them.  Any ideas would be appreciated.  Thank you.

Offline

#2 2008-10-30 11:48:03

JMD
GLPI - Lead
Registered: 2004-09-13
Posts: 9,180
Website

Re: Mail Gateway - Connection Failed - PHP Error

Are you sure that 192.168.140.65 is ready to receive from your GLPI server (lan ? firewall ?)
Are you sure that 192.168.140.65 accept connections in imap/pop  ?


JMD / Jean-Mathieu Doléans - Glpi-project.org - Association Indepnet
Apportez votre pierre au  projet GLPI   : Soutenir

Offline

#3 2008-10-30 13:33:40

jpalmer99
Member
Registered: 2008-08-29
Posts: 17

Re: Mail Gateway - Connection Failed - PHP Error

I tested by way of using telnet to port 110 for pop from the GLPI server and doing a manual logon with the mailbox's credentials.  That worked no problem.

If possible I would like to get POP working over IMAP.

Last edited by jpalmer99 (2008-10-30 14:03:55)

Offline

#4 2008-10-30 14:49:54

jpalmer99
Member
Registered: 2008-08-29
Posts: 17

Re: Mail Gateway - Connection Failed - PHP Error

GLPI server is running on Centos5.  I updated PHP to 5.2.6 with same result.

Offline

#5 2008-10-30 15:53:37

JMD
GLPI - Lead
Registered: 2004-09-13
Posts: 9,180
Website

Re: Mail Gateway - Connection Failed - PHP Error

If you say that you mail server could be joined from the GLPI server  and if you have an PHP error that says it's impossible to connect to your mail server.  It would be a configuration problem do you use tls or ssl etc ?


JMD / Jean-Mathieu Doléans - Glpi-project.org - Association Indepnet
Apportez votre pierre au  projet GLPI   : Soutenir

Offline

#6 2008-10-30 23:23:11

jpalmer99
Member
Registered: 2008-08-29
Posts: 17

Re: Mail Gateway - Connection Failed - PHP Error

No TLS or SSL for either POP or IMAP.  Is there other logging I can look at somewhere that might help?

Offline

#7 2008-10-31 00:03:09

JMD
GLPI - Lead
Registered: 2004-09-13
Posts: 9,180
Website

Re: Mail Gateway - Connection Failed - PHP Error

It's not really a GLPI problem,  this a php error . Php could'nt connect to 192....

Are you sure you give the a correct login and mdp in your mailgate configuration ?

You could have a look to you mail server log to see if there is a connection or not, and if it's a probleme of login or other.


JMD / Jean-Mathieu Doléans - Glpi-project.org - Association Indepnet
Apportez votre pierre au  projet GLPI   : Soutenir

Offline

#8 2008-10-31 20:15:51

jpalmer99
Member
Registered: 2008-08-29
Posts: 17

Re: Mail Gateway - Connection Failed - PHP Error

Ok, got this working.  I looked into the PHP side of things and the imap_open function.  One thing I did notice that in the scripts that quotes "" where usually put around the open_imap string (that is an observation from a non-script guy).

Here is what I did to test and how I got it working in case it might help someone.

I copied a sample php script to call imap_open and put it in my http directory and called it like this

http://myserver/test.php

So I verified that apache and php could open up my imap mailbox that I setup.  I then experimented with different things inside of the {} brackets to test.  This is the string that worked in the test script:

{your.imap.host:143/notls}

So what I did was the same in the Mail Gateway screen.  Left the IMAP/POP blank (and everything else) and just filled in the port number.  This gave me the same line as my test screen:

{myserver.host.com:143/notls}

And then it worked.  But I could get neither the test script or the mail gateway screen to work with anything else.

Any questions about what I did please let me know and I'll answer the best I can.  Thank you for the help JMD.


Here is the script:

<?php
$mbox =ap_open("{your.imap.host:143}", "username", "password");

echo "<h1>Mailboxes</h1>\n";
$folders = imap_listmailbox($mbox, "{your.imap.host:143}", "*");

if ($folders == false) {
    echo "Call failed<br />\n";
} else {
    foreach ($folders as $val) {
        echo $val . "<br />\n";
    }
}

echo "<h1>Headers in INBOX</h1>\n";
$headers = imap_headers($mbox);

if ($headers == false) {
    echo "Call failed<br />\n";
} else {
    foreach ($headers as $val) {
        echo $val . "<br />\n";
    }
}

imap_close($mbox);
?>

Last edited by jpalmer99 (2008-10-31 20:38:38)

Offline

#9 2009-05-30 19:10:03

michaelroman
Member
Registered: 2007-06-29
Posts: 21

Re: Mail Gateway - Connection Failed - PHP Error

Thank you, you helped us to resolve the same problem...

In the mail gateway setup you just have to set like this:
IMAP  [empty]  NO-TLS  [empty]

And it works !

Offline

#10 2010-03-09 13:23:31

saraben
Member
Registered: 2010-02-03
Posts: 101

Re: Mail Gateway - Connection Failed - PHP Error

Hi everyone thanks for sharing it is very helpful

In the mail gateway setup I set like this:
IMAP  [empty]  NO-TLS  [empty] but still did not work ...tried the script and this is the error that I get

Warning: imap_open() [function.imap-open]: Couldn't open stream {MyMailhost:995} in C:\xampp\htdocs\test.php on line 2
Mailboxe


Warning: imap_listmailbox(): supplied argument is not a valid imap resource in C:\xampp\htdocs\test.php on line 6
Call failed
Headers in INBOX


Warning: imap_headers(): supplied argument is not a valid imap resource in C:\xampp\htdocs\test.php on line 17
Call failed

Warning: imap_close(): supplied argument is not a valid imap resource in C:\xampp\htdocs\test.php on line 27


I think the probleme here is the GLPI server cannot connect to the Mail server ...what do you think?

Thanks for taking the time to read my post and help

Regards

Offline

Board footer

Powered by FluxBB