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.

List email accounts with PHP

Discussion in 'E-mail Discussions' started by snakex, Nov 25, 2006.

  1. snakex

    snakex Member

    Joined:
    Aug 21, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Portugal, Porto
    Hi.

    Is it possible to list all the email accounts that are in a cPanel account with PHP?

    Thanks.
     
  2. freedog96150

    freedog96150 Well-Known Member

    Joined:
    Mar 25, 2005
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Nevada, USA
    I know that this is not a direct reply as I am not answering your question about PHP, but Chirpy has written an excellent script that cover what you are asking and more. Checkout Chirpy's WHM script at http://configserver.com/cp/cmm.html
     
  3. HelloAdam

    HelloAdam Well-Known Member

    Joined:
    Nov 6, 2005
    Messages:
    145
    Likes Received:
    0
    Trophy Points:
    16
    Hey,

    You could use cURL, which will pull the information from the page and on to a PHP page. But theirs is no simple "command" that will do this...

    From,
    Adam
     
  4. snakex

    snakex Member

    Joined:
    Aug 21, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Portugal, Porto
    I'm working on it, so far i have this, it is working but if you view the source of the page you a lot of blank lines i can't get rid of hem :|

    Code:
    $page = file_get_contents("http://".$this->_user.":".$this->_pass."@".$this->_host.":".$this->_port."/frontend/".$this->_skin."/mail/pops.html");
    $start_tag = 'Login';
    $start_tag_pos = strpos($page, $start_tag);
    $end_tag = 'Show Disk Space Used';
    $end_tag_pos = strpos($page, $end_tag, $start_tag_pos);
    $test = substr($page, $start_tag_pos+strlen($start_tag), $end_tag_pos-$start_tag_pos-strlen($start_tag));
    $test = strip_tags($test);
    $test = str_replace(' ', '', $test);
    $test = trim($test);
    $test = str_replace($this->_user, '', $test);
    If any one as a better solution please let me know!

    Thanks.
     
  5. twz

    twz Registered

    Joined:
    Jun 12, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Hobart, Australia
  6. manderson

    manderson Registered

    Joined:
    Jun 15, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    List of email accounts

    I am also looking to export an entire list of email addresses from cpanel as I have postfix gateway servers I do address verification on ... Anything out there that can do this easily?

    Thanks!
     
Loading...

Share This Page