Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    3

    Default Importing email accounts in mass?

    Is there a way to import new email accounts into cPanel, in mass? I have about 2000 email accounts, and entering them by hand is not an option. Thanks in advance.
    -Shane

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    3

    Default

    I'm looking for the exact same feature. We are currently in the process of designing and maintaining a school website. They have about 500 students, and each student is required to have an email address. We also need to be able to mass delete at the end of each school year. We have been looking at Hive Mail but are unsure of the database structure. Anyways any help would be greatly appreciated. Sorry for hijacking your thread.

    Chris

  3. #3
    Member
    Join Date
    Apr 2003
    Posts
    479

    Default

    If you're using cpanel/exim to manage the accounts, a php script along the line of this should do the trick... to delete the accounts, you would replace doaddpop with dodelpop

    fopen wrappers would have to be enabled because of the file() calling a url.

    This has not been tested. PM me if you need me to implement this for your server.

    PHP Code:
    <?
    $cpanel_username 
    "accountname";
    $cpanel_password "mypass123";
    $cpanel_theme "x";
    $cpanel_url "http://$cpanel_username:$cpanel_password@$cpanel_domain/frontend/$cpanel_theme/mail/doaddpop.html";

    $email_domain "thisschool.com"
    $email_quota 10// quota in MB

    // associative array: keys are email addresses, values are passwords
    $emails = array("john.smith"=>"1234""jane.smith" => "abcd");

    foreach(
    $emails as $email_address => $email_pass){
    $url =  "$cpanel_url?email=$email_address&domain=$email_domain&password=$email_pass&quota=$email_quota";
    if(
    file($url))
      echo 
    "$url      <br>\n";
    else
      echo 
    "ERROR : $url      <br>\n";
    }
    ?>

  4. #4
    Member
    Join Date
    Mar 2007
    Posts
    27

    Default

    supposedly /usr/local/cpanel/cpanel-email can interface to creating or deleting email addresses .... I have yet to find a help file or anything associated. I want to script the creation of email accounts and forwards as well as removal.

    Does anyone know anything about /usr/local/cpanel/cpanel-email ?

  5. #5
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    944
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I know this is an old post, but does anyone know if it works? I need to setup a few hundred email addresses, which I have in an excel spreadsheet with the passwords. Any help would be appreciated. Thank you
    • cPanel :: Fantastico :: RVSkin :: WHM :: ModernBill
    • Reseller Hosting :: SSL Certificates :: Domain Registrations :: Affiliate Program
    • Blog Hosting :: CMS Hosting :: Forum Hosting :: E-Commerce Hosting
    SoftDux- The Leaders in Software
    Use the coupon: cpanel-06 to get 20% off our packages

  6. #6
    cPanel Partner NOC This forum account has been confirmed by cPanel staff to represent a vendor.cPanel Partner NOC Badge
    Join Date
    Nov 2001
    Location
    San Clemente, Ca
    Posts
    703

    Default

    /scripts/addpop <email> <pass>

    I think that still works, i have not tested it so give it a try first... if it works it should be very easy for you to take a CSV file and loop it into that script.
    Shaun Reitan
    NDCHost.com - cPlicensing.net - ProVPS.com
    Contact us for your cPanel Licensing needs! We Price Match, We provide Support, We take care of our customers!

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    3

    Default

    Quote Originally Posted by shaun View Post
    /scripts/addpop <email> <pass>

    I think that still works, i have not tested it so give it a try first... if it works it should be very easy for you to take a CSV file and loop it into that script.
    Well how do you call this in PHP? I tried sudo and so many options, it gives unknown error in php, and then I tried also writing perl script but looks like cpanel's custom tag does not let Text::CSV load.

    Php API is not very useful because it requires "x" theme also everything has been upgraded up to x3 and we cant use old theme and moreover even basic authentication is not supported so php xml api is not working.

    /scripts/addpop is right way but only if someone can show in php how to exactly use it.

  8. #8
    cPanel Partner NOC This forum account has been confirmed by cPanel staff to represent a vendor.cPanel Partner NOC Badge
    Join Date
    Nov 2001
    Location
    San Clemente, Ca
    Posts
    703

    Default

    system("/scripts/addpop arg1 arg2 arg3");

    php will need to be running as the user root.
    Shaun Reitan
    NDCHost.com - cPlicensing.net - ProVPS.com
    Contact us for your cPanel Licensing needs! We Price Match, We provide Support, We take care of our customers!

Similar Threads & Tags
Similar threads

  1. Any advice in importing multiple email accounts?
    By Jonathan More in forum E-mail Discussions
    Replies: 1
    Last Post: 04-29-2011, 01:09 PM
  2. Importing Email Accounts
    By b1ackjosh in forum E-mail Discussions
    Replies: 1
    Last Post: 09-28-2010, 08:49 AM
  3. importing email accounts
    By GoTTi in forum E-mail Discussions
    Replies: 7
    Last Post: 02-14-2005, 09:33 PM
  4. importing email accounts for cobalt xtr
    By esarakaitis in forum E-mail Discussions
    Replies: 0
    Last Post: 08-18-2004, 11:34 AM
  5. Importing email accounts in mass.
    By shaniac in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-17-2004, 06:04 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube