How to add custom mail handler in Plesk?

Created:

2016-11-16 12:52:48 UTC

Modified:

2017-08-08 13:32:20 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to add custom mail handler in Plesk?

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux
  • Plesk 12.0 for Linux

Question

How to add custom mail handler in Plesk?

Answer

Mail handler can be added using /usr/local/psa/admin/sbin/mail_handlers_control utility:

Input stream formats:
add : |<handler name>|<queue>|<type>|[mailname]|<priority>|<executable>|[context]|[enabled]|[dont-preserve-on-restore]|

For example:

# /usr/local/psa/admin/sbin/mail_handlers_control --add --priority=5 --name=check-quota-permanent --queue=before-queue --type=global --mailname=all-recipients --executable=/usr/local/psa/handlers/hooks/check-quota --context=permanent --enabled

# /usr/local/psa/admin/sbin/mail_handlers_control --list
.---.---.-------.----------------.-----------------.-----------.-----------------.
| E | P | prior | address | name | type | queue |
|---|---|-------|----------------|-----------------|-----------|-----------------|
| | | 10 | all | spf | global | before-queue |
| X | | 10 | all-recipients | check-quota | global | before-queue |
| X | | 10 | all-recipients | check-quota | global | before-sendmail |
| X | | 5 | all-recipients | limit-out | global | before-queue |
| X | | 5 | all-recipients | limit-out | global | before-sendmail |
| X | X | 5 | all-recipients | new | global | before-queue |
'---'---'-------'----------------'-----------------'-----------'-----------------'

Note : Option 'P' in the table above means protected. This is a special option to avoid custom mail handler removing when using repair utility such as 'mchk' .

Keep in mind that the lower priority number, the higher handler priority. Handler with option --priority=5 has higher priority than --priority=10 .

Have more questions? Submit a request
Please sign in to leave a comment.