Managing multiple email accounts can become time-consuming, especially when you need to suspend or unsuspend several accounts at once. Instead of manually going through each account in the cPanel interface, you can automate the process using cPanel’s API.
Procedure
Suspend Entire Domain’s Outgoing Mail
If you want to suspend outgoing mail for the entire domain, you can run the following command:
whmapi1 suspend_outgoing_email user=example
Suspend a Specific Email Account
To suspend the login access for a specific email account, use this API command:
uapi --user=username Email suspend_login email=user%40example.com
Suspend Incoming Mail for a User
If you need to suspend only the incoming mail for a particular email account, use this command:
uapi --user=username Email suspend_incoming email=user%40example.com
Suspend Outgoing Mail for a User
Similarly, to suspend outgoing mail for an email account, run:
uapi --user=username Email suspend_outgoing email=user%40example.com
Unsuspending an Account
If you need to reverse any suspension, simply change the command from suspend to unsuspend. For example, to unsuspend the login for a specific user, you would use:
uapi --user=username Email unsuspend_login email=user%40example.com
These commands can help you streamline the process of managing multiple email accounts, making it quicker and more efficient to suspend or unsuspend incoming, outgoing, or login access