Jump to content

Telnet in php


Re-JeeP

Recommended Posts

Hi!

I want to se how many mails I've got on my mail-server.

I come up wih the code below but it dosen't work!

[code]<?php
function telnet_check_status($server, $port, $user, $pass)
{
$fp = fsockopen($server, $port, $errno, $errstr, 10);

if(!$fp) {
echo "Error: $errstr ($errno)<br />";
}
else
{
$command = "USER ".$user."\r\n";
fwrite($fp, $command);
$command = "PASS ".$pass."\r\n";
fwrite($fp, $command);
$command = "QUIT\r\n";
fwrite($fp, $command);

while(!feof($fp)) {
$result .= fgets($fp, 128);
}

fclose($fp);
}

echo $result;
}
?>[/code]

I get the folowing message:
[quote="message"]+OK POP3 server ready (7.1.026.6) <7BDB52E280D9D910ED3F7A00A4BFD90EE706287D@pne-msproxy2-sn2.hy.skanova.net> +OK Password required -ERR [SYS/PERM] mailbox locked by a POP3 session[/quote]

Any ideas?
Link to comment
https://forums.phpfreaks.com/topic/15019-telnet-in-php/#findComment-60627
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.