Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    2

    Question doaddpop and doadddomain via php

    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 . "&quota=" . $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.
    Last edited by mickie2000; 03-20-2004 at 12:12 PM.

  2. #2
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    I can't help with your problem, but would you mind posting your function to add the subdomain?

    I have been trying to figure it out and can't.

    Thanks
    Damion

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    2

    Default Dynamic subdomain and email with CPANEL

    THE SOLUTION -- UNINSTALL CPANEL. Absolutely could not get any help from cpanel or the supposed "experts" so we removed cpanel ad went back to a stripped down Linux server... Everything works flawlessly now.

  4. #4
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default

    Originally posted by noimad1
    I can't help with your problem, but would you mind posting your function to add the subdomain?

    I have been trying to figure it out and can't.

    Thanks
    Damion
    The real solution:

    http://forums.cpanel.net/showthread....253#post111253

    After trial and error I got that to successfully add a subdomain.

Similar Threads & Tags
Similar threads

  1. doaddpop hook?
    By dorris in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 04-16-2008, 06:32 AM
  2. Working doaddpop Script.
    By blue44 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 05-01-2005, 05:18 AM
  3. doadddomain.html
    By asmithjr in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-18-2005, 09:31 AM
  4. Cpanel doaddpop problem
    By chriswatson in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-28-2004, 10:59 AM
  5. Replies: 0
    Last Post: 03-23-2004, 07:20 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube