Tim Parker
Tim Parker

Reputation: 1

Creating cPanel email accounts with fopen

I'm using the following code to create an email account and a email forward at the same time. I'm consfused as the email forward works every time (f2) and the email creation is only working roughly half the time (f1). I'm a PHP newbie and can't understand what could cause this. Any help is appreciated!

$f = fopen ("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$username&domain=$cpdomain&password=$password&quota=0", "r");
        fclose($f);
    $f2 = fopen ("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddfwd.html?email=all&domain=$cpdomain&fwdemail=$email&fwdopt=fwd&submit=Add Forwarder", "r");
        fclose($f2);

Upvotes: 0

Views: 2189

Answers (2)

Crazy Developer
Crazy Developer

Reputation: 409

with fopen

$fopen ("http://$cp_user:$cp_pass@$cp_domain:2082/frontend/$cp_skin/mail/doaddpop.html?email=$user&domain=$e_domain&password=$e_pass"a=$e_quota", "r");

for full plugin..

1.http://tobbynews.com/create-e-mail-account-in-c-panel-using-php.html 2.http://forums.cpanel.net/f42/xmlapi-php-class-111897.html

you can ask for support in cpanel's support for assistance..

Upvotes: 2

John
John

Reputation: 13720

Yahoo is closing down Yahoo Mail Classic so I'm having to implement my own email. I currently use JustHost. I've made an effort to make the variables as easy to understand. If you don't understand what they mean then FIRST contact your host because (presuming you get a competent tech on the line) they'll understand what you'll need.

<?php
//exampledot.com for domain

$cpuser = 'exampled';////////////e.g. exampled, your cPanel main domain usually
$cppass = 'CPANEL-PASSWORD';/////Your cPanel password.
$cpdomain = 'exampledot.com';////The cPanel domain
$cpskin = 'justhost';////////////listed on cPanel as 'theme'
$emailname = 'john1';/////////////The username, e.g. [email protected]
$emaildomain = 'exampledot.com';////The domain name in email, @exampledot.com
$emailpass = 'EMAIL_PASSWORD';////The password for the email account
$quota = '25';///////////////////Megabytes of space, 0 for unlimited


$homepage = file_get_contents("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$emailname&domain=$emaildomain&password=$emailpass&quota=$quota");
echo $homepage;
?>

I used just that code and then checked cPanel and the email account was created.

So your URL does work, it was just that file_get_contents function is what you want to use.

Upvotes: 2

Related Questions