We are trying to implement mail handler in before-remote queue. However it is getting fired for all addresses, remote and local. We need either an explaination or information on how to get all locally served mail domains from Plesk.
Please advice,
Anton.
[root@plesk-onyx ~]# plesk sbin mail_handlers_control --list --json
{"handlers": [
{
"queue": "before-queue",
"type": "global",
"enabled": false,
"priority": 10,
"name": "spf",
"address": "all",
"executable": "/usr/local/psa/handlers/hooks/spf",
"context": "none",
"protected": false
},
{
"queue": "before-remote",
"type": "global",
"enabled": true,
"priority": 5,
"name": "my_handler",
"address": "all",
"executable": "/usr/local/bin/my_handler.sh",
"context": "none",
"protected": true
},
{
"queue": "before-queue",
"type": "global",
"enabled": true,
"priority": 10,
"name": "check-quota",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/check-quota",
"context": "none",
"protected": false
},
{
"queue": "before-sendmail",
"type": "global",
"enabled": true,
"priority": 10,
"name": "check-quota",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/check-quota",
"context": "none",
"protected": false
},
{
"queue": "before-queue",
"type": "global",
"enabled": true,
"priority": 5,
"name": "limit-out",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/py-limit-out",
"context": "limit",
"protected": false
},
{
"queue": "before-sendmail",
"type": "global",
"enabled": true,
"priority": 5,
"name": "limit-out",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/py-limit-out",
"context": "limit",
"protected": false
}
]}
Nov 29 10:36:41 plesk-onyx xhandler: /usr/local/bin/my_handler.sh none [email protected] [email protected] Date: Tue, 29 Nov 2016 10:36:41 +0000#012To: [email protected], [email protected]#012Subject: test msg#012User-Agent: Heirloom mailx 12.5 7/5/10#012MIME-Version: 1.0#012Content-Type: text/plain; charset=us-ascii#012Content-Transfer-Encoding: 7bit#012X-PPP-Message-ID: <[email protected]>#012X-PPP-Vhost: ex2.com#012#012test#012 PPP_SENDER_USER_ID=10001 LANG=C LC_ALL=C PPP_INSIDE_SENDMAIL=1 LOGNAME=ex2 USER=ex2 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/www/vhosts/ex2.com
Nov 29 10:36:41 plesk-onyx xhandler: /usr/local/bin/my_handler.sh none [email protected] [email protected] Date: Tue, 29 Nov 2016 10:36:41 +0000#012To: [email protected], [email protected]#012Subject: test msg#012User-Agent: Heirloom mailx 12.5 7/5/10#012MIME-Version: 1.0#012Content-Type: text/plain; charset=us-ascii#012Content-Transfer-Encoding: 7bit#012X-PPP-Message-ID: <[email protected]>#012X-PPP-Vhost: ex2.com#012#012test#012 PPP_SENDER_USER_ID=10001 LANG=C LC_ALL=C PPP_INSIDE_SENDMAIL=1 LOGNAME=ex2 USER=ex2 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/www/vhosts/ex2.com
Please advice,
Anton.
[root@plesk-onyx ~]# plesk sbin mail_handlers_control --list --json
{"handlers": [
{
"queue": "before-queue",
"type": "global",
"enabled": false,
"priority": 10,
"name": "spf",
"address": "all",
"executable": "/usr/local/psa/handlers/hooks/spf",
"context": "none",
"protected": false
},
{
"queue": "before-remote",
"type": "global",
"enabled": true,
"priority": 5,
"name": "my_handler",
"address": "all",
"executable": "/usr/local/bin/my_handler.sh",
"context": "none",
"protected": true
},
{
"queue": "before-queue",
"type": "global",
"enabled": true,
"priority": 10,
"name": "check-quota",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/check-quota",
"context": "none",
"protected": false
},
{
"queue": "before-sendmail",
"type": "global",
"enabled": true,
"priority": 10,
"name": "check-quota",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/check-quota",
"context": "none",
"protected": false
},
{
"queue": "before-queue",
"type": "global",
"enabled": true,
"priority": 5,
"name": "limit-out",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/py-limit-out",
"context": "limit",
"protected": false
},
{
"queue": "before-sendmail",
"type": "global",
"enabled": true,
"priority": 5,
"name": "limit-out",
"address": "all-recipients",
"executable": "/usr/local/psa/handlers/hooks/py-limit-out",
"context": "limit",
"protected": false
}
]}
Nov 29 10:36:41 plesk-onyx xhandler: /usr/local/bin/my_handler.sh none [email protected] [email protected] Date: Tue, 29 Nov 2016 10:36:41 +0000#012To: [email protected], [email protected]#012Subject: test msg#012User-Agent: Heirloom mailx 12.5 7/5/10#012MIME-Version: 1.0#012Content-Type: text/plain; charset=us-ascii#012Content-Transfer-Encoding: 7bit#012X-PPP-Message-ID: <[email protected]>#012X-PPP-Vhost: ex2.com#012#012test#012 PPP_SENDER_USER_ID=10001 LANG=C LC_ALL=C PPP_INSIDE_SENDMAIL=1 LOGNAME=ex2 USER=ex2 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/www/vhosts/ex2.com
Nov 29 10:36:41 plesk-onyx xhandler: /usr/local/bin/my_handler.sh none [email protected] [email protected] Date: Tue, 29 Nov 2016 10:36:41 +0000#012To: [email protected], [email protected]#012Subject: test msg#012User-Agent: Heirloom mailx 12.5 7/5/10#012MIME-Version: 1.0#012Content-Type: text/plain; charset=us-ascii#012Content-Transfer-Encoding: 7bit#012X-PPP-Message-ID: <[email protected]>#012X-PPP-Vhost: ex2.com#012#012test#012 PPP_SENDER_USER_ID=10001 LANG=C LC_ALL=C PPP_INSIDE_SENDMAIL=1 LOGNAME=ex2 USER=ex2 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/www/vhosts/ex2.com