• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    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.

Generic Mail Handler

R

Raphael@

Guest
Hi guys,

I'm kind of stuck trying to create a mail handler. I created a php executable script in my root directory, I set the uid bit as requested in the plesk-8.2-unix-mod-api.pdf
but for the rest I don't know if I should set certain user/group or place the file in a certain location or where to find feedback (logs?) if things go wrong. I tried to output some stuff to a file through the script but no do.

So to recap:

1. What would be the right user/permissions for the handler
2. Does the location matter
3. How would I debug the script.

Wow 35 views and no comments yet. Ok letst start with what I got:

PHP:
<?php

  $contents="";
  while (!feof(STDIN)) {
    $contents .= fread(STDIN, 8192);
  }

  $myfile=fopen("/tmp/aaa",'a');
  fwrite($myfile,$contents);
  fclose($myfile);

  $error_out="STOP\n";
  fwrite(STDERR, $error_out);
  exit(0);
?>

I register this with:

PHP:
/usr/local/psa/admin/sbin/mailmng --add-handler --handler-name=1my_handler-ld [email protected] --executable=/roo
t/bin/handler.php --context=context --hook=before-local

which seems to work fine.
 
Back
Top