Pipe - Email to PHP script

Skill Level Required - Moderate to High

To make this work you must first set an email on your account forward to a file.

To achieve this login to your cPanel / Web Panel and select "Forwarders" under the Mail category.

Than click the button called "Add Forwarder"

Enter email address and select the domain to the email and then click "Advanced Options" at the bottom.

Now select the option "Pipe to a Program" and enter the path from the "Home" folder (behind the public_html folder) and enter the directory address to where the scripted is located on your account.

Click "Add Forwarder"

Your Pipe email scripted should contain the on the first line only the following: " #!/usr/bin/php -q" followed by on the next line with "" and no close "?>" in the scripted.

The Following is an example of a Piping scripted:

#!/usr/bin/php -q

// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd))
$email .= fread($fd, 1024);

mail('your@email.com','From my email pipe!','"' . $email . '"');

Note: you need all directory leading to the scripted including the piping file need to have 755 permission set for this to work.
Also the piping scripted must be in the cgi-bin folder for it to work with out returnning a rebount message.

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

Put my website on my account?

To be able to put your website on your account you need to be able to access your file manager...

Is SSH on my account?

SSH can be enabled on request for shared hosting accounts. Please submit a support ticket if you...

Is FFmpeg supported?

Unfortunately FFmpeg is not supported on shared hosting.If you wish to uses FFmpeg you will need...

How to add a subdomain to my website?

A subdomain is a domain that is part of a larger domain. i.e. subdomain.relentlesshosting.com.au...

How do I unblock myself from the firewall?

If you have gotten yourself blocked by the firewall on our server you can follow the following...