• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.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 [email protected] --executable=/roo
t/bin/handler.php --context=context --hook=before-local

which seems to work fine.
 
Back
Top