The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automatic Creation of E-mail Accounts

Discussion in 'E-mail Discussions' started by drewtemp, Feb 15, 2004.

  1. drewtemp

    drewtemp Member

    Joined:
    Feb 15, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I've tried the posted scripts here to create an e-mail account within cPanel but none of them work for me. The server is running cPanel Build 8.8.0-RELEASE 10 and I don't know if this will help out any, but in the left information section (in the x theme), it says "cPanel Pro 0.9.9.2 (RC8)". Is there any code that could be useful? I've tried the following:
    PHP:
    <?php
    $authstr 
    "$cpaneluser:$cpanelpass";
    $pass base64_encode($authstr);
    $in "GET /frontend/x/mail/doaddpop.html?email=$acct&domain=$domain&password=$mpassword&quota=$meg\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
    $socket fsockopen($host,2082);
    fputs($socket,$in);
    fclose($socket);
    ?>
     
  2. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    try the search button on the forum. I remember someone discussing this earlier.
     
  3. drewtemp

    drewtemp Member

    Joined:
    Feb 15, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    It's OK. I figured it out myself. I did a function where it calls the page on the server to create it instead of doing the socket connection. Thanks anyway, I guess I should have posted it earlier. I have it set up on http://www.drewtemp.com Take a look if you please and you can sign up for an e-mail account at drewtemp.com or rapocity.us
     
  4. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    congrats !

    :)
     
  5. MrStatic

    MrStatic Registered

    Joined:
    Feb 14, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    why not post the working code?
     
  6. dinek

    dinek Member

    Joined:
    Sep 15, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Poland
    That would be nice :)
     
  7. drewtemp

    drewtemp Member

    Joined:
    Feb 15, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Here is the code :):

    PHP:
    <?php
    function create_acct($acct$domain$meg$mpassword$cpaneluser$cpanelpass) {
        
    $o "http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/mail/doaddpop.html?email=$acct&domain=$domain&password=$mpassword&quota=$meg";
        
    $tester = @file($o);
    }

    function 
    remove_acct($acct$domain$cpaneluser$cpanelpass) {
        
    $o "http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/mail/realdelpop.html?email=$acct&domain=$domain";
        
    $tester = @file($o);
    }
    ?>
    Replace "x" with the theme you are using for cPanel.
     
  8. dinek

    dinek Member

    Joined:
    Sep 15, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Poland
    hmmmm... a question...

    Will that work with the ne IE fix?? As far as I know http://user:passwd@domain.com:2082/..... doesn't work anymore (at least after updating iE). Or am I wrong?

    Thank BTW :)
    D.
     
  9. drewtemp

    drewtemp Member

    Joined:
    Feb 15, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Doesn't open through IE. Opens that file through the server-side and not on the client side.
     
  10. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    This worked for me! New IE does not matter
     
  11. MrStatic

    MrStatic Registered

    Joined:
    Feb 14, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Okay I went to your site and borrowed your form and im gonna try this out but would I just save the php part as a php file then
    <form method="post" action="makemail.php?action=make_email">
    ?
     
  12. drewtemp

    drewtemp Member

    Joined:
    Feb 15, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I recommend you do an activation for a user to validate his/her account. If you do not validate it, it could attract spammers and then your domain name will become in people's "Junk Mail" folder. Once the form is submitted, send it to a page that will insert a certain get that is md5 encrypted and use that as a key. I run a cron every day about about 3:00am CST so if the user has not yet activated their account in 2 days, then it will be removed from the database and they will have to verify it again. On the page that does the activation, do it where it will update you "active" field in the database to a "1" and everything. I will upload a script on my site for download some time so you can download it once I do that. Thanks for all of your responses. You may use this code freely all you want, it was very simple and is easier than doing the socket connection.
     
  13. quasiman

    quasiman Member

    Joined:
    Aug 26, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Portland, Oregon
    cPanel Access Level:
    Root Administrator
    I would really appreciate a download of this!! I tried to use your script, but I'm not sure exactly how to implement it...it looks like there's two scripts there; one for adding an account, one for removing the account. So how would I use a form to post to only one of those?
     
  14. Roy@ENHOST

    Roy@ENHOST Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    495
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Los Angeles California
    I saw this on your site:
    If there is numerous e-mails coming from your account, your account will be removed without warning.

    Did you have a script to detect that?
    If you do that is real neat.

    Anyway there was an account activation error when I tried to activate my account:

    Parse error: parse error in /home/drewtemp/public_html/modules/Email/activate.php on line 22

     
    #14 Roy@ENHOST, Apr 6, 2004
    Last edited: Apr 6, 2004
Loading...

Share This Page