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.

I want to get a list of all the email accounts on my server

Discussion in 'E-mail Discussions' started by drcoco, Jan 5, 2007.

  1. drcoco

    drcoco Registered

    Joined:
    Jun 17, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Guys,

    First of all I want to thank you in advance for any help that could be provided to this issue/question.

    We recently moved our offices, so we want to send an email to all of our email accounts in the server, letting them know the new location of our offices, as well as inform them about some improvements and changes performed in our company.

    Is there a way to get a list of all email accounts created on the hosting server? We currently manage the server ourselves, so anything that would be required to do, whereas starting a sessions in the server with the root user or something to that matter, can be completely done.

    Please let me know if there's any way to get this done, for that would greatly help us.

    Thanks again,

    Francisco
     
  2. jpetersen

    jpetersen Well-Known Member

    Joined:
    Dec 31, 2006
    Messages:
    113
    Likes Received:
    4
    Trophy Points:
    18
    As root:

    find /home/*/.contactemail | xargs strings | sort -u

    Caveats:

    * If a user doesn't have their contact email set in their cPanel, .contactemail will be empty.

    * This doesn't grab email addresses for non default accounts.
     
  3. oderland

    oderland Well-Known Member
    PartnerNOC

    Joined:
    Dec 30, 2002
    Messages:
    103
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Kungsbacka, Sweden
    Someone that have a clue how to get all this info on a csv file:
    contactemail , all domains on account or default domain, package type
     
  4. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    You can email all the clients on your server from WHM >> Account Functions >> "Email all Users" option. Refer the URL: http://cpanel.net/docs/whm/Email_All_Users.htm
     
  5. oderland

    oderland Well-Known Member
    PartnerNOC

    Joined:
    Dec 30, 2002
    Messages:
    103
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Kungsbacka, Sweden
    Used part of other scripts here to solve it .

    Code:
    for i in `awk -F: '/home/ {print $1};' /etc/passwd`
    do
    email=`cat /home/$i/.contactemail`
    domain=`cat /var/cpanel/users/$i |grep DNS=`
    plan=`cat /var/cpanel/users/$i |grep PLAN=`
    if test -n "$email"; then
    echo $email, $domain, $plan  >> list.txt
    fi
    done
    
    It's only takes default domain but that was enough for me this time.
     
Loading...

Share This Page