Solved Modify email quota with API

jigster

Verified User
Joined
Jul 23, 2021
Messages
93
How do I change an email account's quota with the API? I assume this is possible but I can't find any reference to it using CMD_API_POP and all things I've tried have so far failed! Thanks
 
Anyone? I've successfully found and scripted all the other API functions we need and this is the very last one we require! But can't find it anywhere. Any help is appreciated. And if it's not possible I can start a feature request. We can't be the only ones who would find this useful! Thanks
 
Thanks. I'd seen those but I think they're just for listing the quota, not changing it. I was hopeful they might be used for what I want but after trying different variable combos I've had no success changing an email's quota! I'm starting to think this is not possible :(
 
1. Open directadmin
2. Navigate to a page where you can change an email account quota
3. Open a browser console and "Network" tab.
4. Change a quota in a browser and see what variables are sent to Directadmin from a browser. That will be what you need to send to an API endpoint.

Use google and learn on how to use a browser console if you don't know it yet.
 
Thanks!! I'd already looked there but I checked it again and realised my mistake - the command is CMD_EMAIL_POP (I'd mistakenly read this as CMD_POP duh!). In case anyone else is interested, to change an email's quota you can use:

Code:
$sock = new HTTPSocket;
$sock->connect("ssl://HOSTNAME",2222);
$sock->set_login("ADMIN|USER",TOKEN);
$sock->query('/CMD_API_EMAIL_POP', [
    'action'  => 'modify',
    'user'    => 'EMAILUSER',
    'newuser' => 'EMAILUSER',
    'domain'  => 'DOMAIN.COM',
    'quota'   => '1024',
    'passwd'  => '',
    'passwd2' => '',
]);
$result = $sock->fetch_parsed_body();

Thanks again @zEitEr
 
Back
Top