at last i figured out setting up email accounts automatically using php

here is the code

$socket = fsockopen($host,2082);
$authstr = "$cpaneluser:$cpanelpass";
$pass = base64_encode($authstr);
$in = "GET /frontend/$cpaneltheme/mail/doaddpop.html?email=$newemail&domain=$domain&password=$mpassword&a=$quota\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
fputs($socket,$in);
fclose( $socket );

i have no problem accessing the account created via outlook...

but when i try to do it via php

$mbox=imap_open("{mail.mydomain.com:143}newlycreatedaccount", "myusername", "mypassword");
if($mbox){
$n=imap_num_msg($mbox);
echo "$n in newlycreatedaccount<br>";
}else{
echo "NOpe in newlycreatedaccount<br>";
}

what i get is "0 in newlycreatedaccount"
i know there is "definitely" one email in the mailbox but i cant seem to retrieve it..

any idea...

regards...

    There is an article giving working code in the Articles seciton of PHPBuilder.com

      Write a Reply...