Suspend email account by API

Metalik

Verified User
Joined
Sep 29, 2010
Messages
6
Hello

Is it possible Suspend email account by API ?

Please advice.

Thank you
 
Hello

Could I ask you please provide a php class sample code to do suspend email account?

Thank you
 
You can find examples on how to use API here: http://files.directadmin.com/services/all/httpsocket/examples/

If to say about suspending email account, then this should work:


CMD_API_POP?user=<email-account>&suspend=Suspend&domain=<domain>&action=delete

GET or POST
You should run this API call at user level.

suspend=Suspend to suspend email account
unsuspend=Unsuspend to unsuspend email account

action
=delete action is always delete here

<email-account> - here goes without domain and without @, for example bob
<domain>
- here goes domain

example of requests:

CMD_API_POP?user=bob&suspend=Suspend&domain=domain.com&action=delete

to suspend [email protected]

CMD_API_POP?user=bob&unsuspend=Unsuspend&domain=domain.com&action=delete

to unsuspend [email protected]

That's up to you to write PHP code.
 
Is &action=delete is a required query? Is it delete the email account? We don't want to delete the account, only suspend.

Thank you very much for your help
 
As I already written earlier:

action=delete action is always delete here, and it does not matter what changes you going to do to an email account.

Open a directadmin page /CMD_EMAIL_POP?DOMAIN=domain.com in your browser and learn HTML code of the page to see what variables you can see (form elements, input fields and buttons). Also you may use Firefox to see what browser sends to Directadmin server on suspend/unsuspend an email account.

Before posting it here I've tested it myself. And sure if you try to call this API without unsuspend= or suspend= you will delete an email account. So test your code in a dev environment.
 
Hi,

Is it possible to get suspend status of an email account by API?

Thank you
 
Back
Top