1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

export email account addresses

Discussion in 'E-mail Discussions' started by JIKOmetrix, Jun 7, 2008.

  1. JIKOmetrix

    JIKOmetrix Member

    Joined:
    Apr 3, 2007
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    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
     
    #1 JIKOmetrix, Jun 7, 2008
    Last edited: Jun 9, 2008
  2. wemail

    wemail Member

    Joined:
    Nov 28, 2006
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    GB
    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
     
    #2 wemail, Jun 8, 2008
    Last edited: Jun 8, 2008
  3. sawbuck

    sawbuck Active Member

    Joined:
    Jan 18, 2004
    Messages:
    1,356
    Likes Received:
    3
    Trophy Points:
    38
    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:

  4. JIKOmetrix

    JIKOmetrix Member

    Joined:
    Apr 3, 2007
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

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

    Mike
     
  5. dgrunwald

    dgrunwald New Member

    Joined:
    Jan 19, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Sawbuck - thanks for that script, it worked great.

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

    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. ghoti

    ghoti New Member

    Joined:
    Jun 23, 2011
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    East London, Eastern Cape, South Africa
    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. Heer

    Heer New Member

    Joined:
    Sep 4, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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. cPanelTristan

    cPanelTristan Active Member
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,621
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    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.
     
  9. willjosefi

    willjosefi New Member

    Joined:
    Dec 9, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Thanks.
    This work great for me.

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

Share This Page