• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Extension Dev - Handling Mails

Hello,

Yes, /opt/psa/admin/plib/modules/PMSP/scripts/mail-handler.sh should be executable. And probably mail-handler should be placed into sbin/, not plib

So it is not possible to implement an Extension for Plesk with an Mail-Handler wich you can install without SSH Access?
 
Yes, you can set proper ownership/permissions on handler in extension post-install.php
 
I updated my post-install.php, but it doesn't seem to work

PHP:
<?php
chmod(dirname(__FILE__).'/mail-handler.sh', 0755);
chown(dirname(__FILE__).'/mail-handler.sh', 'popuser.postfix');

pm_ApiCli::callSbin('mail_handlers_control', array('--add', '--priority', '50', '--queue=before-queue', '--type', 'global', '--executable', dirname(__FILE__).'/mail-handler.sh', '--enabled', '--name', 'PMSP'));
pm_ApiCli::callSbin('mail_handlers_control', array('--add', '--priority', '50', '--queue=before-sendmail', '--type', 'global', '--executable', dirname(__FILE__).'/mail-handler.sh', '--enabled', '--name', 'PMSP'));

Here's the output:

Code:
root@v22016081573736335:~# plesk bin extension -i /root/PMSP-0.1-2.zip
PHP Warning: chmod(): Operation not permitted; File: /opt/psa/admin/plib/modules/PMSP/scripts/post-install.php, Line: 2

PHP Warning: chown(): Unable to find uid for popuser.postfix; File: /opt/psa/admin/plib/modules/PMSP/scripts/post-install.php, Line: 3

The extension was successfully installed.

Why does chmod not work? How could I get this done so that I can finally start implementation of my Extension?
 
ugh. sorry I looked up just "plesk bin" and not "plesk sbin". For otheres, this ways works:

PHP:
<?php
pm_ApiCli::callSbin('ch_mode', array('+x', dirname(__FILE__).'/mail-handler.sh'));
pm_ApiCli::callSbin('ch_owner', array('popuser:postfix', dirname(__FILE__).'/mail-handler.sh'));

pm_ApiCli::callSbin('mail_handlers_control', array('--add', '--priority', '50', '--queue=before-queue', '--type', 'global', '--executable', dirname(__FILE__).'/mail-handler.sh', '--enabled', '--name', 'PMSP'));
pm_ApiCli::callSbin('mail_handlers_control', array('--add', '--priority', '50', '--queue=before-sendmail', '--type', 'global', '--executable', dirname(__FILE__).'/mail-handler.sh', '--enabled', '--name', 'PMSP'));

Now it works. nice.
 
That script could be PHP? Or do it have to be Shell?

PHP *is* shell, just use "#!/bin/php" in the first line and "<?php" in line two followed by your php code. Remember, the /etc/php/cli/php.ini (or similar, depending on your distribution) is used for command line while there is another version for apache and other webservers.
 
Back
Top