|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
/bin/sed ??
I wasn't too sure where to post this question. I assumed as it was server side and something to do with Apache i would post here.
I have a forwarder for an e-mail address being pointed to a PHP script. This all worked fine until a user put a " in the message body. To combat this i was told to point the forwarder to sed to take out the " or replace them. This would then repoint the outputted text to my php script again. In theory it should work, but in practice, a different story. Below is that command that the forwarder has: | /bin/sed 's/\"/\\\\\"/g' -e | php -q /home/username/catch.php " $h_subject " "$sender_address" "$message_body" In theory, or what ive been told, is this should remove the unwanted " in the passed along email. But, theres a problem which i cant figure out. I get a lovely error email, shown below: This message was created automatically by mail delivery software (Exim). 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 | /bin/sed 's/"/\\"/g' -e | php -q /home/username/catch.php " help " "me@mydomain.com" "work?? "i hope" so " generated by testaddress@mydomain.com Child process of virtual_address_pipe transport returned 1 from command: /bin/sed The following text was generated during the delivery attempt: ------ pipe to | /bin/sed 's/"/\\"/g' -e | php -q /home/username/catch.php " help " "me@mydomain.com" "work?? "i hope" so " generated by testaddress@mydomain.com ------ /bin/sed: -e expression #1, char 1: Unknown command: ``|'' Does anyone have any ideas why this isnt working? or even better a solution?? Thanks for any help received, David |
|
#2
|
|||
|
|||
|
Why are you using the -e switch without any command?
You should either remove the -e or place it right after /bin/sed. >> I wasn't too sure where to post this question Definitely not Apache forum. I'd say: 1) UNIX; 2) Mail Servers; 3) PHP |
|
#3
|
||||
|
||||
|
Ok, i shall remember for next time where to post, sorry
![]() If you mean using sed like this: | /bin/sed -e 's/\"/\\\\\"/g' | php -q /home/username/catch.php " $h_subject " "$sender_address" "$message_body" Then i tried that with the -e after /bin/sed Still doesnt like it. Anything else? David |
|
#4
|
|||
|
|||
|
Why can't you just cat message_file | sed 's/"/\\"/g' and see? That's all that has to do with sed.
Now that I think your catch.php has its own problem and you should look for a better solution to parse email message. If you are just doing it on the command line, there are many program out there that can parse email message for you. There is no need to call a PHP binary and go thru your catch.php at all. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > /bin/sed ?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|