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.

creating email question

Discussion in 'E-mail Discussions' started by Mark36ph, Feb 8, 2007.

  1. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    hello.
    what i am wanting to do is for people to fill out a form on my website and to be able to make there own email address (therename@mydomain.com)

    what i need to know is what script to use.
    how can i do it?

    Thanks.
     
  2. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
  3. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    can someone help me?
     
  4. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    I just took a look at the script you linked to and it should actually work.

    make sure you change everthing to match your cpanel

    If you want to see how this works, just replace the capitalized values, assuming you have your default theme set to the "x" theme.

    Code:
    http://USER:PASS@YOURDOMAIN.COM:2082/frontend/x/mail/doaddpop.html?email=TEST&domain=YOURDOMAIN.COM&password=PASSWORD&quota=50
     
  5. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    can you try the script out on your cpanel?
    i just tryed it again and it does not seem to work for me.
    theone you told me to try works though.

    or if you could make this output an error onto a nice little box if the username is taken

    http://www.daniweb.com/techtalkforums/post239522-5.html
     
  6. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    that last script you linked to will grab the output of whatever happened.

    you should parse the $txt output to your liking.

    when a email already exists, you'd normally get something like:

    if it doesn't exist you get the following on successful creation:

    so you could so just add some code to do
    PHP:
    if (preg_match("/already exists/"$txt)){ echo "Sorry the username you chose is already in use or is reserved. Please try again.";}
    else if (
    preg_match("/\+/"$txt)){ echo "Congrats! your email account has been setup. Your email account is ".$_GET['username']."@domain.com and your password is ".$_GET['username'].".";}
    else{echo 
    "An unknown error occurred. Please try again later";}
     
    #6 ujr, Feb 9, 2007
    Last edited: Feb 9, 2007
  7. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    thanks ill give that a go and let you know what happens :)
     
  8. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    i tryed adding that code you said and i get this error

    Code:
    Parse error: syntax error, unexpected T_ELSE in /home/name/public_html/index.php on line 219
    like 219 is
    PHP:
    else{echo "An unknown error occurred. Please try again later";}
     
  9. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    just add a } bracket to the end of the line above it... simple typo. Then it should work
     
  10. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    sorry to sound stupid, but do i need to change "/already exists/" at all?
    if not, it does not seem to be allowing it to work, when i attempt to create an email account, it says An unknown error occurred. Please try again later
     
  11. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    change it to the above code... i changed it before. should work now.
     
  12. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    i still seem to get An unknown error occurred. Please try again later
     
  13. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    try changing:

    else if (preg_match("/\+/", $txt))

    to:

    else if (preg_match("/successfully created/", $txt))

    but the last else will be useless, as the error messages from cpanel itself aren't that unique. For instance when the user exists, it still says "successfully created" at the end of the line. Since this is the second condition, it will work, but you'll need to add any other distinct error messages explicitly, so it catches them.
     
  14. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    same error again :confused:
     
  15. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    echo the $txt and paste the wording here.
     
  16. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    it seems to be creating now, but it is giving a big window saying it has been created instead of just the text :confused:
     
  17. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    aha!!
    its sorted now :D
    i fixed it somehow :confused:

    thanks for your help, i really appriciate it :)


    oh, just another quick thing, dont matter if its not possible, is it possible to delete an account with the password if it is later unwanted?
     
  18. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    likely, you are still echoing the $txt output. just uncomment the line that reads
    echo $txt;
     
  19. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    yes, you could allow password changes, and even delete accounts, but that would need to be scripted.
     
  20. Mark36ph

    Mark36ph Active Member

    Joined:
    Jun 18, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    don;t suppose you could help could you?
    i'm not good at php coding as you can prob tell ;)
    if not, then don;t worry
     
Loading...

Share This Page