Goldeneye Posted April 23, 2010 Share Posted April 23, 2010 Well, I`m trying to create a script or class to interface PHP and MySQL with an IMAP server. I would use the PHP IMAP-Extension but because it isn`t a standard extension, it`s not complied on the Webserver I`m currently using. What I currently have is... $username = 'foo'; $password = 'bar'; $handle = fsockopen('localhost', 143, $errint, $errstr, 15); $query = 'LOGIN {' . strlen($username) . "}\r\n$username". ' {' . strlen($password) . "}\r\n$password"; fputs($handle, $query); $query = 'SELECT INBOX'; fputs($handle, $query); $query = 'FETCH 8 BODY[]'; fputs($handle, $query); echo fgets($handle); I thought the code would work but all that is echo`d is * OK Dovecot ready. So, how do I go about connecting to (and reading from) an IMAP Server using sockets? Quote Link to comment https://forums.phpfreaks.com/topic/199444-accessing-imap-server-using-fsockopen-fgets-and-fputs/ Share on other sites More sharing options...
oni-kun Posted April 23, 2010 Share Posted April 23, 2010 because it isn`t a standard extension' date=' it`s not complied on the Webserver I`m currently using.[/quote'] http://pear.php.net/package/Mail_IMAP/download/All You don't need access to the server's configuration or compilation. Just the include path. Quote Link to comment https://forums.phpfreaks.com/topic/199444-accessing-imap-server-using-fsockopen-fgets-and-fputs/#findComment-1046793 Share on other sites More sharing options...
Goldeneye Posted April 23, 2010 Author Share Posted April 23, 2010 Please excuse my ignorance: Being a PEAR virgin, I really have no idea how to install this. I`ve looked at tutorials found through a Goolge Search, but I am finding them too ambiguous or simply not working for me. I tried ''pear install Mail_IMAP-1.1.0RC2'' in a PuTTY session but that didn`t work. How do I manually install it? Quote Link to comment https://forums.phpfreaks.com/topic/199444-accessing-imap-server-using-fsockopen-fgets-and-fputs/#findComment-1046804 Share on other sites More sharing options...
trq Posted April 23, 2010 Share Posted April 23, 2010 How do I manually install it? Its just php code so put it somewhere on your server (preferably on your include path) and include it per usual. Be aware that PEAR's imap class has nothing at all to do with php's imap extension. Quote Link to comment https://forums.phpfreaks.com/topic/199444-accessing-imap-server-using-fsockopen-fgets-and-fputs/#findComment-1046825 Share on other sites More sharing options...
Goldeneye Posted April 23, 2010 Author Share Posted April 23, 2010 I just noticed, PEAR/Mail_IMAP and it`s v2 child both require the PHP IMAP Extension as a dependancy. This means, I can`t use it because the PHP IMAP extension is not installed; doesn't it? Edit: It doesn`t appear to be working for me, anyway. I have setup my server-settings exactly as they should be but I still get, `Error: Unable to build a connection.` Quote Link to comment https://forums.phpfreaks.com/topic/199444-accessing-imap-server-using-fsockopen-fgets-and-fputs/#findComment-1046847 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.