• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

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 --sender=test@xxxxx.xxx --executable=/roo
t/bin/handler.php --context=context --hook=before-local

which seems to work fine.
 
Back
Top