Question

I've been searching for an answer for 2 days now and have found so much, but still can't get this to work.

I have a WHM server with a cPanel account.

I have created the following php script under public_html at /home/USERNAME/help-system/parse.php for testing:

#!/usr/local/bin/php -q
<?php
mail('****@davidslack.co.uk', 'Test email', 'Test email to get an email into the script');
?>

I have also created a forwarder in cPanel that forwards to:

|/home/USERNAME/help-system/parse.php

The php script and directory have permissions 0755 (also tried 0777)

Now, when I send an email to the correct address I get a bounce back email like:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

  pipe to |/home/USERNAME/help-system/parse.php
    generated by *********@davidslack.co.uk
    local delivery failed

The following text was generated during the delivery attempt:

------ pipe to |/home/USERNAME/help-system/parse.php
       generated by *********@davidslack.co.uk ------

Extension '/home/USERNAME/help-system/parse.php' not present.

------ This is a copy of the message, including all the headers. ------

What have I missed? Is there a WHM or cPanel setting I haven't enabled? Have I done something stupid with the above?

Any help would be much appreciated.

Cheers.

Was it helpful?

Solution

Email Piping, looks like it can't understand the windows newline!

So:

  1. Create php script
  2. Add hashbang to the top of the script
  3. Upload
  4. Open in cPanel -> File manager -> Code editor
  5. Delete the newline after the hashbang and add it back in
  6. Save

All working now

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top