Click to See Complete Forum and Search --> : urgent help needed re: pop3 access WITHOUT imap


mitya
10-08-2003, 06:07 PM
Hi all

I've spent the night trying to learn how to talk to a POP3 server via PHP, and looking, unsuccessfully, for tutorials or clear information on it.

Can anyone tell me how you call a message on the POP3 server in PHP and print it out? I can logon fine, but after that I'm stumped. I know the POP3 commands, but I've no idea what the syntax is to use them WITHIN php, i.e.

If anyone could help I'd be most grateful, or if you know of any tutorials which deal with this or discuss POP3 access via fsockopen and NOT imap (I don't have that enabled on my host account).

Thanks a lot.

pyro
10-08-2003, 06:13 PM
You are still going to need to use the imap (http://us3.php.net/imap) functions to do this. You might also want to look at this article: http://www.devshed.com/Server_Side/PHP/PHPMail/PHPMail1/page1.html.

mitya
10-09-2003, 04:31 AM
THanks Pyro- sadly I don't have IMAP access but nevermind

piersk
10-09-2003, 04:41 AM
When you say you don't have IMAP, do you mean that you don't have the IMAP "extension" for PHP, or you don't have access to an IMAP server?

mitya
10-09-2003, 04:43 AM
The imap functions go unregognised on my PHP server. Actually I've tried it on three PHP servers and they all fail.

Even if it was down to the mailbox rather than the server, I need this thing to work for most mailboxes which is why I have an interest in getting it to work via fsockopen etc... if this is possible?

piersk
10-09-2003, 04:49 AM
Yeah, you should be able to use the fsockopen() (http://www.php.net/fsockopen) function to open port 110 and go on from there.

Please note that I've not looked at the networking functions in PHP, so can't really help you anymore than that...

mitya
10-09-2003, 04:51 AM
I can open the socket. I can also find out how many messages are waiting for me. What I can't do is actually display them. I don't know how you integrate the POP3 commands into PHP to actually print this out. Something along the lines of...

print("RETR 1");

...which is obviously incorrect but hopefully you can see what I'm trying to do.

For some reason the RETR statement only returns the size of the message in octets, not the actual message itself as it should (?)