Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

unsuspend_login blocking hook

Discussion in 'cPanel Developers' started by AndyB78, May 8, 2017.

  1. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    Hello,

    First, allow me to apologize for all the noob questions/assumptions below. I am 100% new to hookable events.

    The problem I am trying to solve
    Naturally, when a customer is sending spam (voluntarily or as in most cases, involuntarily) we suspend the email account affected. The problem is that there are reckless/ill-advised/thick-skinned/confused customers that simply reactivate the email account without solving the underlying problem. Naturally the spam resumes.

    What I am trying to do
    I am trying to find a way to prevent the above problem by denying the unsuspension of email accounts suspended (programmatically or not) for spam right upon the unsuspension attempt, so a custom error is returned to the customer attempting this (or at least even a generic error).

    Questions:
    1. Generally speaking are hookable events, the way to accomplish this or I understood completely wrong what hookable events are?
    2. Is there an appropriate hookable event for this?

    Additional question:
    3. Is there a better or at least easier way to solve this?

    Thanks!
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. AndyB78

    AndyB78 Well-Known Member

    Joined:
    Oct 7, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Romania
    Hi,

    Thank you for your feedback. I was aware of this function but I am not trying to suspend the email sending capabilities of the entire cPanel account. I want to obtain the best outcome with minimum impact on the user's activity so I just want to be able to suspend an email account in such a way that it stays suspended.

    Is there a way to intercept an attempt from the user to reactivate a suspended email address?

    Thanks!
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You may want to vote and add feedback to the following feature request, as it's for the functionality you are seeking:

    Suspend Outgoing mail for single mail account

    As far as using hooks to prevent a cPanel user from unsuspending the login for an email account, you could develop a custom bash script that immediately suspends the login again using the following UAPI function:

    UAPI Functions - Email::suspend_login - Software Development Kit - cPanel Documentation

    For the purposes of hooks, the corresponding UAPI function when using the "Unsuspend Login" option for email accounts in cPanel is:

    UAPI::Email::unsuspend_login

    Thus, you'd run your custom bash script as a hook for the unsuspend_login UAPI function using the instructions at:

    Guide to Standardized Hooks - Cpanel Functions - Software Development Kit - cPanel Documentation

    This would ensure your custom bash script runs automatically anytime someone unsuspends an email account login.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice