Re: Pipe To A Program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





I used your code and it still didn't work. Would you show me what you put in for your Pipe To A Program settings?

What I used is:

Rules: "To" "Contains" customer service e-mail address

"Action"
/usr/local/bin/php /path/to/email_to_ticket_gateway.php

- I know the rule is working because I receive an empty e-mail, just not passing the e-mail content



Ron Piggott



www.TheVerseOfTheDay.info

-----Original Message----- From: tamouse mailing lists
Sent: Saturday, November 12, 2011 4:04 AM
To: Ron Piggott
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  Pipe To A Program

On Sat, Nov 12, 2011 at 1:38 AM, Ron Piggott
<ron.piggott@xxxxxxxxxxxxxxxxxx> wrote:
Does anyone know what variable the e-mail message is assigned within the context of “Pipe To A Program”? Is there a way to find out? I can’t figure this out.

What I have tried so far is below:

===
#!/usr/local/bin/php -q
<?php


foreach($_REQUEST as $key => $val) {
    $$key = $val;

$email_body .= "KEY: " . $key . "\r\n";
$email_body .= "VAL: " . $val . "\r\n";
$email_body .= "\r\n";

}

mail( user@domain , "Test Pipe To Program" , $email_body );
===

The mail command works, but the e-mail message body is empty. I am at a loss of how to proceed.

Ron

I'm not sure what's going on with your program, exactly. Here's what I
tried:

start script<<
<?php

foreach($_REQUEST as $key => $val) {
   $$key = $val; // do not know what this is supposed to do here...

   $email_body .= wordwrap("KEY: " . $key . "\n",70,"\n");
   $email_body .= wordwrap("VAL: " . $val . "\n",70,"\n");
   $email_body .= "\n";

}

print_r($email_body);

mail( 'tamara@localhost' , "Test Pipe To Program" , $email_body );
end script<<

(Note: according to http://us3.php.net/manual/en/function.mail.php:

"Each line should be separated with a LF (\n). Lines should not be
larger than 70 characters."

Which is why I added the wordwrap on each line and terminated the
lines with "\n" instead of "\r\n".)

Calling the script, print_r showed the string as expected:

start output<<
tamara@caesar:~/$ curl 'http://localhost/~tamara/testmail.php?a=1&b=2&c=3'
KEY: a
VAL: 1

KEY: b
VAL: 2

KEY: c
VAL: 3

end output<<

And the email message showed up in my inbox:

tamara@caesar:~/$ from
<www-data@caesar> Test Pipe To Program

And the contents of the email are:

start email<<
Return-Path: <www-data@caesar>
Delivery-Date: Sat Nov 12 02:54:13 2011
Envelope-to: <tamara@localhost>
Return-path: <www-data@caesar>
Received: from www-data by caesar with local (masqmail 0.2.27) id
1RP9Lp-0oD-00 for <tamara@localhost>; Sat, 12 Nov 2011 02:54:13 -0600
To: tamara@localhost
Subject: Test Pipe To Program
X-PHP-Originating-Script: 1000:testmail.php
From: <www-data@caesar>
Date: Sat, 12 Nov 2011 02:54:13 -0600
Message-ID: <1RP9Lp-0oD-00@caesar>


KEY: a
VAL: 1

KEY: b
VAL: 2

KEY: c
VAL: 3
end email<<


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux