Updated Sat. Mar 20th
*------------------------------------------------------
I've fixed this and run into another... I just needed to swap the order of the auth string and the host and add a connection close before the user data line and it let me in.
The problem now, is that I get the error "Sorry, you do not have access to the domain <DOMAINNAME>." Anyone have experience with this? I've tried adding the email account directly in Cpanel and it's successful... but my script gets that error for every domain no matter what I try...
*-----------------------------------------------------------
I've been messing with this for 2 days and am totally frustrated.
First... emails. No matter what I try, I'm getting an access denied message from trying to access doaddpop.html via my PHP script. I tried using several versions listed in these forums and none worked, so I re-wrote my own as follows...
*----- Begin Script
function addEmailAccount($email, $password, $domain, $quota, $prefix)
{
// take in the accounts info... and submit to cpanel
$error = "";
$loginInfo = base64_encode($cPanelInfo["user"] . ":" . $cPanelInfo["password"]);
$accountData = "email=" . $email . "&domain=" . $domain . "." . $extenstion . "&password=" . $password . ""a=" . $quota;
if (!$socket = fsockopen($domain, 2082, $errno, $errstr, 30))
{
$error .= $errstr . "(" . $errno . ")";
}
else
{
// build header to send to the webpage
echo("begin header generation<br>");
$header = "POST frontend/x/mail/doaddpop.html HTTP/1.1\r\n";
$header .= "Authorization: Basic " . $loginInfo . "\r\n";
$header .= "Host: " . $domain . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen ($accountData) . "\r\n\r\n";
if (!fputs($socket, $header . $accountData))
{
// output post variables
$error .="Header Post 112 failed.<br>";
}
else
{
//Get the reply from the server
echo($header . "<br>");
while (!feof($socket))
{
echo(fgets($socket, 1024));
}
echo("<br>Done.");
}
fclose($socket);
}
if ($error != "")
{
return $error;
}
else
{
return true;
}
}
*----- end code
All the echo's are for debugging. The premise is to create an email account for a newly created subdomain after a user signs up...
second ?....
Is there a way to configure cpanel or doadddomain.html to add the subdomain directory to a specific place? For example it currently adds the directory in the root of the web directory of the root domain... I'd like to configure this to add it in the /members/X directory where X is the first letter of the username... for organization.



LinkBack URL
About LinkBacks
Reply With Quote




