Lets try working via sockets.
Replace this code:
// Create email account
$f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota", "r");
if (!$f) {
$msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode';
}
else {
$msg = "<h2>Email account {$euser}@{$edomain} created.</h2>";
}
with:
$sock = fsockopen($cpdomain,2082);
if(!$sock) {
print('Socket error');
exit();
}
$request = "/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota";
$authstr = "$cpuser:$cppass";
$pass = base64_encode($authstr);
$in = "GET $request\r\n";
$in .= "HTTP/1.0\r\n";
$in .= "Host:$host\r\n";
$in .= "Authorization: Basic $pass\r\n";
$in .= "\r\n";
fputs($sock, $in);
$result = '';
while (!feof($sock)) {
$result .= fgets ($sock,128);
}
fclose( $sock );
// Check result
if (ereg ("already exist", $result)) {
$msg = "<h2>Email account {$euser}@{$edomain} already exists.</h2>";
}
else {
$msg = "<h2>Email account {$euser}@{$edomain} created.</h2>";
}