Email Account Registration without cpanel login!

taya9taya10

Registered
Oct 3, 2004
1
0
151
Is there any one can help PHP Script to register email account without cpanel login?
I tried this PHP scripts. I can use only one day. That scripts doesn't work on next day :(
Who can help me?????? :)
<?
if ($submit){
$host = "CPanel IP";
$port = 2083;
$path = "/frontend/rvblue/mail/doaddpop.html";


$cpaneluser = "user name";
$cpanelpass = "cpanel password";
$authstr = "$cpaneluser:$cpanelpass";
//****************************


$pass = base64_encode($authstr);


$formdata = array ( "email" => $email, "domain" => $host, "password" => $password, "quota" => $quota);

foreach($formdata AS $key => $val){
$poststring .= urlencode($key) . "=" . urlencode($val) . "&";
}

$poststring = substr($poststring, 0, -1);

$fp = fsockopen($host, $port, $errno, $errstr, $timeout = 30);

if(!$fp){

echo "$errstr ($errno)\n";

}else{



fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Authorization: Basic $pass \r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $poststring . "\r\n\r\n");

fclose($fp);
}
print "Account Created";
}else{

?>
<form method="post">
Username:<input type="text" name="email"><br>
Password:<input type="password" name="password"><br>
Quota:<input type="text" name="quota">
<input type="submit" name="submit" value="true">
<? } ?>
 

memooney

Registered
Oct 5, 2004
2
0
151
Looking for something similar.

I'm looking for something similar. I want ot have user use their cPanel created email/passwords to login to a web portal. This would allow them to use one login/pswd rather than storing a new login/password in a database.

It sounds like we are both looking for similar things.

Matt
 

jhohorst

Registered
Nov 2, 2006
1
0
151
Creating Mail Accounts Through cPanel with PHP

Try this:

$f = fopen ("http://$cpuser:[email protected]$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$account&domain=$domain&password=$password&quota=$quota", "r");
if (!$f) {
return FALSE;
} else {
while (!feof ($f)) {
$line = fgets ($f, 1024);
if (ereg ("already exists", $line, $out)) {
return $line;
break();
}
}
fclose($f);
}
retrun TRUE;

Where $cpuser, $cppass, $cpdomain relate to your cPanel account, and $cpskin is the skin you use (usually 'x' or 'x2' - check your URL), and $account, $domain, $password and $quota specify the account you want to create (e,g, $account='yourname', $domain='yourdomain.com' to create the address '[email protected]'). The quota is in megs, 10 or 20 are usual numbers.