dongyan6503 2013-06-13 18:31
浏览 39

使用fopen创建cPanel电子邮件帐户

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);
  • 写回答

2条回答 默认 最新

  • douwei1921 2013-06-14 21:35
    关注

    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. john1@exampledot.com
    $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.

    评论

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数