Greetings : I am in hosted unix server with EXIM mail transfer agent. I need to pipe in cpanel (11) a php script
which (has a hashbang similar to your url
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_24822194.htmlOn any incoming message want to delete and/or change
the string abcdef below
Want to pipe it in cpanel (11) to a php script:
delete and/or change the string on the below
message-body on the incoming email (to my server)
and then foward it to a desired email adress
say myname@otherdomain.com
The message-body of the incoming is :
[19/10 01:34] [9990100053] [] [incoming] abdcdf
x:(1 of 1) from all of us
yd:Best wishes for the Holydays.
----
Your above url has something similar (I think) what i am looking for.
If your below script (from above url) does what I want to do
(or another script you may suggest)-
I do not know where new string and old string would go?
(for example, where my new string call it SOLVED .
Also where in the script would go myname@otherdomain.com (pls see above)
---
Your above url has the following script "
line item -
1:00 #!/usr/bin/php -q
2:00 <?php
3:00 // read from stdin
4:00 $fd = fopen("php://stdin", "r");
5:00 $email = "";
6:00 while (!feof($fd)) {
7:00 $email .= fread($fd, 1024);
8:00 }
9:00 fclose($fd);
10:00 // handle email
11:00 $lines = explode("\n", $email);
12:00 // empty vars
13:00 $from = "";
14:00 $subject = "";
15:00 $headers = "";
16:00 $message = "";
17:00 $splittingheaders = true;
18:00 for ($i=0; $i < count($lines); $i++) {
19:00 if ($splittingheaders) {
20:00 // this is a header
21:00 $headers .= $lines[$i]."\n";
22:00 // look out for special headers
23:00 if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
24:00:00 $subject = $matches[1];
25:00:00 }
26:00:00 if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
27:00:00 $from = $matches[1];
28:00:00 }
29:00:00 } else {
30:00:00 // not a header, but message
31:00:00 $message .= $lines[$i]."\n";
32:00:00 }
33:00:00 if (trim($lines[$i])=="") {
34:00:00 // empty line, header section has ended
35:00:00 $splittingheaders = false;
36:00:00 }
37:00:00 }
38:00:00 mail($from, "Re:" . $subject, "Message received.");
39:00:00 ?>
Thanks