Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

How to get a complete email list

Discussion in 'cPanel Developers' started by Sarabanda, Jun 1, 2017.

  1. Sarabanda

    Sarabanda Registered

    Joined:
    Jun 1, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello

    I need a complete list of email used by my users . This list should include
    pop , forwarders, and also an email like this mailing-owner@domain.com .

    I have seen that
    cpapi2 --user=username Email listforwards
    list all email forwards of an user .

    and
    cpapi2 --user=username Email listlists

    list all email used by mailman.

    But how to list all various email like this (used by mailman) using cpapi2 from console ?

    Code:
    mailing-admin@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman admin mailing_domain.com"
    mailing-bounces@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman bounces mailing_domain.com"
    mailing-confirm@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman confirm mailing_domain.com"
    mailing-join@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman join mailing_domain.com"
    mailing-leave@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman leave mailing_domain.com"
    mailing-owner@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman owner mailing_domain.com"
    mailing-request@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman request mailing_domain.com"
    mailing-subscribe@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman subscribe mailing_domain.com"
    mailing-unsubscribe@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman unsubscribe mailing_domain.com"
    mailing@domain.com: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman post mailing_domain.com"
    
    BTW there is a fast way to get all email in a server , really ALL and of any type/kind ?

    Thank you!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I don't believe it's possible to list those entries via an API command, but you can find them listed in the following file:

    Code:
    /etc/valiases/$domain.tld
    Thank you.
     
  3. Sarabanda

    Sarabanda Registered

    Joined:
    Jun 1, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    indeed it's not possible, hoping to have this possibility in API3 :(;)
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I encourage you to open a feature request if you'd like to see an additional API function added:

    Submit A Feature Request

    Thank you.
     
  5. SactoBob

    SactoBob Member

    Joined:
    Aug 15, 2015
    Messages:
    15
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Sacramento
    cPanel Access Level:
    DataCenter Provider
    Was searching for similar solution as well as I need to populate all my emails for a specific domain to an ldap server in order to outsource spam filtering. If you have shell/server access this works:

    uapi --user=account_name Email list_pops | grep email | sed 's/email://'
    uapi --user=account_name Email list_forwarders | grep dest | sed '/html/d' | sed '/uri/d' | sed 's/dest://' | grep '@'

    Replace "account_name" with the cPanel account you need to collect email addresses from. Those two commands will produce a list of all valid email accounts for the domain. The one exception is the email for the "Main Account" which is basically the account_name gets listed too (last one in the list_pops command), but it's listed without an "@" so the last "grep '@'" removes that too.

    This produces a list of all email and forwarders for an account that can then be further processed as needed. For mailman stuff, doesn't it basically use all the same email formats for a particular list? If you can get a list of lists, you can from that infer the email aliases it creates. You can get your lists using:

    uapi --user=account_name Email list_lists | grep 'list:' | sed 's/list://'

    Again, assuming you have shell access.
     
    #5 SactoBob, Aug 27, 2017
    Last edited: Aug 27, 2017
    cPanelMichael likes this.
  6. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,370
    Likes Received:
    5
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page