Creating cPanel email accounts with fopen
Asked Answered
N

2

0

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);
Nasion answered 13/6, 2013 at 18:31 Comment(2)
Try using file_get_contents() instead of fopen()/fclose() and you can echo out the contents to the screen to see if cpanel is sending you an errorAttlee
You hate the new Yahoo Mail too?Laroy
L
2

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.

Laroy answered 14/6, 2013 at 21:35 Comment(0)
A
2

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..

Afresh answered 30/12, 2013 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.