CPanel API

From GoBlueMich Wiki
Jump to navigation Jump to search


listaccts - cli

  • List all cPanel usernames
whmapi1 listaccts searchtype=user want=user | grep "user: " | awk '{print $2}'


Domain Info


  • List all domains under a cPanel account
    • Variables = CPUSER
uapi --user=$CPUSER DomainInfo list_domains | egrep -v 'apiversion: 3|func: list_domains|module: DomainInfo|  data:|  messages: ~|  metadata: \{\}|  status: 1'


list_pops - cli

  • List all Email accounts for a domain
    • Variables = CPUSER, DOMAIN
uapi --user=$CPUSER Email list_pops | grep "email:"| grep "@" | grep "$DOMAIN" | awk '{print $2}' | awk -F"@" '{print $1}'

store_filter - cli

  • Add MailSecure filter for blocking mail sent directly to IP, bypassing MS.
    • Variables = CPUSER, DOMAIN, and MAILACCT
uapi --user=$CPUSER Email store_filter filtername="Filter Mail Bypassing MailSecure" account="$MAILACCT"%40"$DOMAIN" action1=deliver dest1="\"$local_part+spam\"@$domain" part1=\$message_headers match1="does not contain" val1="" opt1=and part2=\$message_headers match2="does not contain" val2="X-Barracuda-Connect"