Suspend Email Account Login Using cPanel UAPI

  WHM

Introduction

The Email Suspend Login function in cPanel allows administrators to immediately prevent a user from logging into their email account. This is useful for situations where an account may be compromised, inactive, or requires temporary access restriction.

Key points:

  • Suspending login does not stop incoming emails. The user will still receive emails in their inbox.
  • Suspension is immediate and prevents all authenticated connections to the email account.
  • To resume login, the suspension must be removed using the corresponding UAPI function.
  • If you want to stop receiving emails, a different UAPI function must be used.

Prerequisites

Before using the suspend_login function, ensure the following:

  1. cPanel Access: You must have administrative access to the cPanel account where the email resides.
  2. API Access: UAPI must be available and accessible for your cPanel version (tested on version 11.134.0.13).
  3. Credentials: Username and password for basic authentication or an API token with sufficient privileges.
  4. Target Email: You must know the email address that you want to suspend.

Steps / Usage

1. Prepare the UAPI Command

Use the uapi command-line tool to suspend an email login:

uapi --output=jsonpretty \
  --user=username \
  Email \
  suspend_login \
  email='test@example.com'

Parameters:

  • --user=username: The cPanel username.
  • Email suspend_login: The module and function being called.
  • email='test@example.com': Target email address to suspend.
  • --output=jsonpretty: Optional, formats the output for readability.

Conclusion

The Email Suspend Login UAPI function is a straightforward and powerful tool for administrators to control access to email accounts without affecting email delivery. By following the steps above:

  • You can temporarily block access to specific accounts.
  • Keep email delivery operational.
  • Maintain a secure email environment.

Always verify the result.status and result.errors fields after executing the API to ensure that the operation completed successfully.

LEAVE A COMMENT