Is there any way to print the number of email accounts in cpanel using php?

Posted by admin | Programming & Design | Saturday 6 March 2010 7:41 pm


I have a free email service at www.hencomail.com. I would like to be able to use php to print the number of email accounts created. Is this possible? I noticed Cpanel prints them on its sidebar so I would like to do something similar.

1 Comment »

  1. Comment by Josh — March 9, 2010 @ 8:37 pm

    Unfortunately cPanel doesn’t seem to provide much in the way of an api for programmers, or at least not for PHP.

    Your best bet is probably to create a small shell script that counts these addresses and then call script that from PHP

    The shell script might look something like this:
    find ~/mail | grep ‘@’ | wc -l

    And the php might look like this:

    $cmd = ‘/path/to/your/script.sh’;
    $output = array();
    exec($cmd, $output);
    $mail_accounts = reset($output);

RSS feed for comments on this post. TrackBack URI

Leave a comment