<strong>What is Email piping?</strong>

Email piping is a technique of sending email message as an input to a program rather than appending the message to the mailbox file, allowing for real-time email delivery and handling.

Email piping means redirecting emails that are coming to an email address to a php/cgi script.

This can be done using forward only email addresses.

How to SET UP Email piping ?

1) Create a file named pipe.php ( permissions – 755 )

(Make sure that you change the relative path /home/domain respectively)

&nbsp;
<pre class="lang:default decode:true ">#! /usr/bin/php -q
&lt;?php
$fd = fopen("php://stdin","r");
$email = "";
while (!feof($fd))
{ $email .= fread($fd, 1024); }
fclose($fd);
$fdw = fopen("/home/domain/public_html/pipemail.txt","w+");
fwrite($fdw, $email);
fclose($fdw);
?&gt;</pre>
2) Create a forward only account in Cpanel (Under Mail section—Forwarders)

Lets create testing@domain.com as a forwarder.

Create testing@domain.com and select the advanced option available &amp; select the option : Pipe to a Program.

Pipe To a Program: public_html/pipe.php

ADD ( Once u enter this Cpanel will automatically add the following and make it look like this |/home/domain/public_html/pipe.php )

How to test this ?

1) Send a mail to the forward only account (testing@domain.com)

2) Go to the file manager of domain.com .

3) You would see a txt file created (pipemail.txt)

4) pipemail.txt would now contain the actual data of the email which you had sent. In short the email content got dumped in this txt file.