Results 1 to 9 of 9

Thread: export email account addresses

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    54

    Default SOLVED: export email account addresses

    Hi,

    Is there a way to retrieve a list of all configured email accounts on my cPanel server. I'd also like to export the forwarders too. I have to keep the cPanel server in sync with a hosted spam filter and it is tedious to review each account via the control panels. I'd like to just get a big list.

    Any thoughts on how to go about doing this? Even if via a non standard method like review files from an SSH terminal.

    Thanks,
    Mike
    Last edited by JIKOmetrix; 06-09-2008 at 07:38 AM. Reason: SOLVED

  2. #2
    Registered Member
    Join Date
    Nov 2006
    Location
    GB
    Posts
    44

    Default

    Quote Originally Posted by JIKOmetrix View Post
    Hi,

    Is there a way to retrieve a list of all configured email accounts on my cPanel server. I'd also like to export the forwarders too. I have to keep the cPanel server in sync with a hosted spam filter and it is tedious to review each account via the control panels. I'd like to just get a big list.

    Any thoughts on how to go about doing this? Even if via a non standard method like review files from an SSH terminal.

    Thanks,
    Mike
    Yes. I know more about the latter as I do this regularly.

    a. Email accounts - this is how I understand it to be:

    Domains are under /home/<hostingaccount>/mail/<domain>
    and in each domain directory there is one directory per email username. I will let somebody who is more knowledgeable give more details on the structure, as I am not sure of what is where (apart from the foregoing).

    b. I am more familiar with Forwarders, and they are in files at /etc/valiases/<domain.name>
    - the filename is the full domain name, or subdomain name if applicable.

    The lines are formatted:

    forwarder@domain.name: destination@another.name

    i.e. both are full email addresses, with a colon and a space in between them.

    Usually the default address is last, with the forwarder name being just an asterisk.

    They are apparently stored alphabetically, but I cannot say whether this is important or not.

    If you upload a file of forwarders, make sure the file ownership is correct, otherwise cPanel will get upset when you try to edit any settings.

    Sorry I can't give much information on the first part of the query.

    HTH
    Last edited by wemail; 06-08-2008 at 06:17 PM. Reason: Remove implied mailto: links
    --
    Wemail ServerAdmin
    (GB)

  3. #3
    Registered Member sawbuck's Avatar
    Join Date
    Jan 2004
    Posts
    1,353
    cPanel/WHM Access Level

    Root Administrator

    Default

    The attached awk script (renamed .doc to upload) will do the trick but doesn't extract forwarders.

    Author's name and contact info along with how to run is included in the file.

    Would be nice to see this functionality included in WHM.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    54

    Smile

    Hi,

    Thank you. With both posts here I can get info I need from the server. Thanks again.

    Mike

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    1

    Default Re: export email account addresses

    Sawbuck - thanks for that script, it worked great.

    Here's the exact command I used to run it successfully:

    ls -d /home/*/mail/*/*/ | awk -f getAllEmail.awk > emailaddress.txt
    I simply copied and pasted the script file into a new file called getAllEmail.awk. Once that was done, I just ran this command from the same directory.

  6. #6
    Registered Member
    Join Date
    Jun 2011
    Location
    East London, Eastern Cape, South Africa
    Posts
    10

    Default Re: export email account addresses

    That script is wonderful and works for all my domains but my largest one. When I run that script I get:

    -bash: /bin/ls: Argument list too long

    Any suggestions?

  7. #7
    Registered User
    Join Date
    Sep 2011
    Posts
    1
    cPanel/WHM Access Level

    Website Owner

    Unhappy Re: export email account addresses

    Hi,

    please tell me how to run this command in cpanel??????. i have loaded the file on mail directory. but really confused

    ls -d /home/*/mail/*/*/ | getAllEmail.awk > emailaddress.txt

  8. #8
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,609
    cPanel/WHM Access Level

    Root Administrator

    Default Re: export email account addresses

    The command is root SSH access level required. It will not run in cPanel but has to be run by someone with root shell access to the machine.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  9. #9
    Registered User
    Join Date
    Dec 2011
    Posts
    1
    cPanel/WHM Access Level

    Root Administrator

    Default Re: export email account addresses

    Thanks.
    This work great for me.

    The problem is: cur@domain, tmp@domain and new@domain

Similar Threads

  1. Replies: 3
    Last Post: 02-10-2014, 10:54 AM
  2. [Resolved] Export list of all email addresses
    By John Schmerold in forum E-mail Discussions
    Replies: 3
    Last Post: 07-01-2013, 11:47 AM
  3. Replies: 0
    Last Post: 05-09-2013, 10:05 AM
  4. Export email account & messages to hmailserver
    By chazzuka in forum E-mail Discussions
    Replies: 2
    Last Post: 09-12-2007, 04:35 AM
  5. Export email from Whm
    By adapter in forum E-mail Discussions
    Replies: 1
    Last Post: 08-25-2005, 05:53 AM
bargain