Search code examples
spam-preventiondcomhmail-server

hMailServer sending limit per day


I want to set a max number of email sent a day for each mailbox on hmailserver to avoid spamming. I am looking for an issue to do this in hmailserver administration and COM API.


Solution

  • I believe there's no such property in hMailServer. You must define a script on OnAcceptMessage event to implement this behaviour hMailserve doc | OnAcceptMessage.

    For the number of emails sent per day you must create some kind of counter (a database table with username, date and count fields) and get the current number of messages in the body of the OnAcceptMessage function. If the count per current user and current day will be reached then reject the email with return code 1 or 2 and a meaningful message. If the count is less return 0 and the email will be sent.