Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

Registering Mail Handlers

 
extensions guideintegrate with system servicesmail servicemanaging handlersplesk features available for extensions

To register a handler, run the following command:

# ./mail_handlers_control --add
                --priority=<number>
                --name=<handler name>
                --mailname=<mailname>
                --queue=<before-local|before-remote|before-queue|before-data>
                --type=<sender|recipient|sender-domain|recipient-domain|global>
                --executable=<executable file>
                [ --context=<context> ]
                [ --enabled ]

The arguments are explained in the following table.

Argument Definition
--name Specifies the handler name. The string is allowed to contain
any character allowed in UNIX file name (that is, anything
except slash and NUL). Registration will fail if a handler with
the specified name has already been registered.
--type

Specifies the type of a handler, may take the following values:

  • global
    handler is called for all messages.
  • sender-domain
    handler is called for messages whenever the domain part of
    the sender address matches the specified domain
  • recipient-domain
    handler is called for messages whenever the domain part of
    one of the recipient addresses matches the specified domain
  • sender
    handler is called for messages whenever the sender address
    matches the specified address
  • recipient
    handler is called for messages whenever any of the recipient
    addresses matches the specified address

--mailname

Specifies a domain or a mail address for the handler-type.

Not required if the handler type is global.

--priority Specifies the hook priority in the queue of hooks.
--executable

Specifies the handler executable file.

Registration will fail if the file does not exist.

--context Specifies the context. This is an opaque string to be passed to
the handler on the command line.
--enabled Specifies whether to enable the handler.
--queue

Specifies the hooking point. Should be one of:
before-queue, before-local, before-remote,
before-data.

See Hooking Points for details.

The following handler is added to filter correspondence before local
delivery:

# ./mail_handlers_control --add
    --name=1my_handler-ld
    --type=sender
    --mailname=myema@example.com
    --executable=/usr/local/bin/my_handler.sh
    --context='context'
    --queue=before-local
    --priority=33
    --enabled
Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts
Knowledge Base

Viewing Mail Handlers

Read More »

Disabling/Enabling Mail Handlers

Read More »

Removing Mail Handlers

Read More »

Event Parameters Passed by Event Handlers – Mail account deleted

Read More »

Hosting Wiki

  • QMAIL
  • Sendmail
  • Plesk
  • Email Autoresponder
  • Mailing Lists
  • Email Alias
  • Email Virus Protection
  • Email Forwarding
  • Webmail
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family