I changed my statement to:
$in=imap_open("{pop.gmail.com:995/pop3}","my@email_address.com",
"mu_password");
but, obviously this is inadequate as $in return bool(false).
Can I make this work ?
bill
Ok, for the wise among you - if I can make it work, how ?
I suppose you have to instruct imap_open() to use SSL. This is from
example #1 in the PHP manual:
// To connect to an SSL IMAP or POP3 server, add /ssl after the protocol
// specification:
$mbox = imap_open ("{localhost:993/imap/ssl}INBOX", "user_id", "password");
--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Thanks for reading the manual for me, but it doesn't work.
After a long time (5 minutes ?) the script terminates with no
output.
here is my test script:
<?php
error_reporting(E_ALL);
echo "about to imap_open <br />";
$in=imap_open("{pop.gmail.com:995/pop3/ssl}","in...@xxxxxxxx.com",
"xxxxxxxxx");
echo "about to get headers - <br />";
$msgs=imap_headers($in); // gets the headers from the currently
available msgs
echo " <br />about to imap close <br />";
imap_close($in);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test/Get Mail</title>
</head>
<body>
Test/Get Mail
</body>
</html>
if I comment out the imap_open statement it runs fine.
Anyone have any suggestions ?
Is there an imap server running on port 995? The normal port for imap
over ssl is 993. Can you telnet into the port (preferably from that
server)?
What does the system log show?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
this is pop over ssl. And - this is gmail who does things their
own way frequently. I have it running just fine from
Thunderbird on port 995, but when I telnet in on that port
manually I get, "Connection to host lost"
On the other hand, when I telnet to pop.gmail.com on port 23 I
get, "Connect Failed"
The normal port for imap
> over ssl is 993. Can you telnet into the port (preferably from that
> server)?
>
> What does the system log show?
I don't think that google is going to let me access their server
logs.
bill
for fun and games I tried:
$in=imap_open("{imap.gmail.com:993/ssl}","in...@xxxxxxxx.com",
"xxxxxxxxx");
which hung
and telneted in to imap.gmail.com:993
which also hung.
when I type in a break, it replied, "connection to host lost," as
if it were waiting for something without having indicated that
the connection was established.
??
bill
>
I am not surprised. Standard pop is port 110, and SMTP mail is port 25.
Port 23 is the interactive remote login telnet service itself. I dont
think manual connection to an SSL service is ever going to work though.
You MIGHT be able to ssh to it however..try ssh pop.gmail.com -p995
Oh that doesn't work..
Looking at the manual
$in=imap_open("{pop.gmail.com:995/pop3/ssl}","in...@xxxxxxxx.com",
"xxxxxxxxx");
should work,
But here is a snippet from the php manual
"Works with Gmail's new IMAP function for personal and for Google Apps.
$mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX",
"user...@gmail.com", "password")
or die("can't connect: " . imap_last_error());"
Also note that old PHP running on windows had a known bug
http://bugs.php.net/bug.php?id=36496
The complete manual page and comments are probably worth a thorough read.
Ah. here's a more useful snippet from the manual comments
>>>>
The following works for connecting via POP3 to a gmail server:
imap_open("{pop.gmail.com:995/pop3/ssl/novalidate-cert}INBOX",
$username, $password);
<<<<
I cant test, cos have no gmail account.
OK, just making sure - you're using 995 and 993 is pretty close; but
looking around, it seems port 995 is reserved for pop3 over ssl (I've
done the imap over ssl but not pop3).
It's been a while since I've looked at the low level stuff, but IIRC the
client is expected to initiate communications (passing an encryption
key? I don't remember for sure). If the server doesn't get acceptable
info, it drops the connection.
> On the other hand, when I telnet to pop.gmail.com on port 23 I get,
> "Connect Failed"
>
OK, so port 23 isn't open. But that's the telnet port, and I would
expect that wouldn't be open. I don't have it open on an of my servers,
either.
> The normal port for imap
>> over ssl is 993. Can you telnet into the port (preferably from that
>> server)?
>>
>> What does the system log show?
>
> I don't think that google is going to let me access their server logs.
>
> bill
>
Yep, I forgot you're using gmail.
Are you sure you have ssl support in PHP? Looks like it's missing, to me.
I've tested your sample code with my Gmail account and it works fine as is.
I don't know if it'll be the case but you must consider two
peculiarities of their mail service:
1. You have to configure your Gmail account to allow POP3 download.
2. Unlike other mail services, Gmail's POP3 server downloads everything
you have, not just the INBOX. Perhaps so have so many messages that it
just times out.
no joy.
If anyone wants to try these out, I would be willing to give them
access to a google account - write me privately:
william-ta...@TechServSys.put-in-a-com
bill
But you never answered my other question - are you sure you have ssl
support in PHP?
--
and ssl is one of the Registered Stream Socket Transports
'--with-imap-ssl'
Compiled and running are two different things. What does phpinfo() show?
I have no idea why IMAP extension functions are not working for you.
Anyway, I do not use that extension because I have a POP3 client class
that uses fsockopen function instead of the imap extension functions. It
works well for accessing Gmail messages using POP3.
http://www.phpclasses.org/pop3class
Take a look at the test_pop3.php example script. The comments tell you
how to setup the class to access specifcally Gmail.
The class also provides a nice feature that allows you to access
messages in POP3 servers as if they were files using regular PHP file
access functions and special URLs. For instance you can retrieve the
first message in your POP3 mailbox in Gmail with a single line of code:
$message =
file_get_contents('pop3://user:pass...@pop.gmail.com:995/1?tls=1');
BTW, if you want to parse the messages to extract their features, which
often you do, you can also use this MIME parser class together with POP3
class.
http://www.phpclases.org/mimeparser
This article tells you more on this:
http://www.phpclasses.org/blog/package/2/post/1-Process-incoming-email-messages-using-PHP.html
--
Regards,
Manuel Lemos
Find and post PHP jobs
http://www.phpclasses.org/jobs/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
No joy, at least your class returns the error message:
Error: 110 could not connect to the host "pop.gmail.com":
Connection timed out
Further information:
I set:
$pop3->port=995;
$pop3->tls=1;
$apop=0;
$pop3->authentication_mechanism="USER";
Not surprising.
on 06/13/2009 08:14 AM bill said the following:
That means your network is most likely blocking outgoing connections to
port 995, meaning there is a firewall in the way.
You need to ask your system administrator to unblock port 995 connections.
Once he answers my questions...
Ive never seen you post a line of code here ever.
That's because you can't read. We all know that.
You also have never posted an intelligent comment in this or any other
newsgroup. It seems you're quite famous in some circles - as a laughing
stock of usenet. I've gotten some good links to other posts of yours.
I also share links to your stoopid comments in this and other newsgroups
with the others.
You have quite a following. We get some great laughs.
And I don't see YOU posting anything *correct* in this thread, either.
If you're so smart, why haven't YOU fixed his problem for him?
Unlike you, I dont contribute unhelful pompous condescending suggestions
when I don't know the answer.
If you don't know the answer, you should keep your fat trap shut. Oh,
wait. Then you wouldn't be able to say ANYTHING, would you? Because
you don't know anything.
No wonder you hide behind an alias. If I were such a fool, I wouldn't
want people to know my real name, either. Especially if it were my boss.
Sorry, I missed your message.
OK, it shows IMAP support for SSL is enabled. But what about SSL
itself? What version of SSL do you have installed on your system?
You should see mod_ssl in your loaded modules; you should also see other
entries for your SSL package (probably OpenSSL) in your environment.
And if you're running this under a web server, you should see the
information in your web server setup section.
on 06/14/2009 07:17 AM bill said the following:
But is Thunderbird running on the same machine on which you are trying
to access Gmail POP3 using PHP?
If so, are you running Windows? If so, could you have authorized
Thunderbird to access Gmail but not PHP?
Another thing, are you sure you set the tls variable to 1, so the POP3
class uses tls to establish the connection?
openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8b 04 May 2006
Anything else you want to know ?
http://www.houndsofheaven.com/ContactManagement/phpinfo.php
ah, good point. The script is running on a commercial shared
server - I will check with them.
>
> Another thing, are you sure you set the tls variable to 1, so the POP3
> class uses tls to establish the connection?
I am sure.
more when I get the reply back from the provider.
>
OK, I set up a test gmail account and tried your code - it worked
perfectly, showing (correctly) no mail in my box.
The next thing to try is to ensure you have access to gmail port 995
from the system you're running the script on. Can you telnet from the
server to pop.gmail.com port 995? You won't be able to do the
handshaking, but it's important to know if it can connect.
working on validating the connectivity - have to wait for the
unbelievably slow tech support people at the host.
more to follow,
thanks
So you have telnet or ssh access to the system? If so, you should be
able to telnet from there.
BTW - if their tech support is this slow, I'd recommend a new hosting
company. IMHO, non-critical requests should be answered within 2-4
hours max.
They confirmed that they have blocked port 995 outgoing for no
apparent reason but they are willing to unblock it (when they get
around to it) for one IP address. Wowie.
Stay tuned and thanks.
bill
bill
I guess I can understand that. Good hosts will block unnecessary ports
for security reasons. The fact they are willing to unblock it for you
is a definite plus.