Missing logical link in knowledge

I've posted problem here.

Now that person implies that I need to gain unix knowledge on pipe.
I know what is pipe. I use it everyday to pipe data from one command to another.

So I have no idea what is missing link in my knowledge here.
That is, if I "figure" pipe I'll solve whole problem there...

Can you help me? :beergrin
 
I have no idea why those people are hammering on about pipes. You're simply posting message headers and a message body on standard input (okay, call it a 'reverse pipe'), which is totally normal.

There's nothing wrong with using:

Code:
sendmail -G -i -f someone@domain someone_else@domain [enter] 
From: someone@domain 
To: someone_else@domain
Subject: test

test
[ctl-d]

or

Code:
sendmail -t someone_else@domain <<EOF [enter]
From: someone@domain
To: someone_else@domain
Subject: smth

smth
EOF [enter]
Of course, you can put this in a text file called 'content':

Code:
From: someone@domain 
To: someone_else@domain
Subject: test

test

and then run

Code:
cat content | sendmail -G -i -f someone@domain someone_else@domain

That's what you do if your email contents are already on file and just need to be piped through sendmail, but Sendmail doesn't mind whether you penetrate it from the front (pipe) or the back (standard input), so to speak ..
 
I think the postfix guys mean you cannot do

Code:
sendmail -G -i -f someone@domain someone_else@domain <message+headers>

All on one line. That's why they're mentioning pipes. The solution is to use the last example DD gave.
 
DUH!

Look here!

I've gave EXACT example, how do I use sendmail which is what DutchDeamon posted and which proves I've already KNEW that but they continued to hammer "solution is in pipe, which you do not understand, and when you do, EVERYTHING shall be solved" :stud

Time wasters! x(

And here is my final response to them
True!

I've goofed searching man pipe, for BASE FreeBSD installation.
AFTER I've installed postfix, then "man 8 pipe" became available!
So here it is: (I've forgot to also search installed pors /apps man pages)

http://www.freebsd.org/cgi/man.cgi?...ath=FreeBSD+7.2-RELEASE+and+Ports&format=html


Now I would like to solve something, as it apperas there is a problem in communication here.
We will talk about piping here and ignore all other issue ATM.

Conversation went this way:


Me:
---
Filter is using this command: (after filtering message and in order to return it filtered back to postfix)
/usr/local/sbin/sendmail -G -i -f root@example1.com john@example2.com
<msg-headers+body-from-above>

<Comment: As we can see, mail(header+body) is at new line, which indicates ENTER has been pressed>


Noel:
-----
> The sendmail commend is a pipe. Don't put headers+body on the command line.

<Comment: As commented above, headers+body AREN'T been on the command line as ENTER has been pressed>
<Comment: This is where major confusion started to arise>


Me:
---
Yes I know that.Simply haven't knew how to formulate this mail comand line.
I send mail by firstly typing: /usr/local/sbin/sendmail -G -i -f root@example1.com john@example2.com
Then I hit enter. Then I paste mail(header + body).
Then I hit:
^D

<Comment: This was critical point AT which major confusion should've been STOPED>
<Comment: As I see, this was supposed to prove I know how to use sendmail and what pipe IS>


Noel:
-----
> Since you don't seem to have understood my answers, probably a
> book on using Unix or Linux would help you most at this point.


<Comment: Here I've been led into believing I have a missing link in knowledge about pipe>


Now how could that be?!?
Now day later, I've found out I've been discovering warm water again.
Duh!

My last "Me:" part must have been proved, that I've know what pipe is. So how come it did not?
What have I done wrong??

Executing "/usr/local/sbin/sendmail -G -i -f root@example1.com john@example2.com" [ENTER]
Gives a PIPE
Then I write mail(header + body)
And how -i arg has been passed to sendmail I dont put a dot "." at new line.
I press ^D [ctrl-D] instead!

Then mail is being sent and sendmail returns it's status code

So why hammering pipe???
 
There was some error when user, other than root, has been filtering mail.
Error was visible only when I manually executed:
Code:
# cat mail_in_file | ./mail_filter.php root@example1.com john@example2.com
[B]Syntax error: "(" unexpected[/B]
I simply changed php code related to execution of shell functions.
Finally, I've completely solved a problem.

Now for a future reference:
where I can find Syntax error: "(" unexpected, error logged, as it wasn't in postfix error log:
/var/log/maillog

Thanks in advance
 
you are probably missing something like

#!/usr/local/bin/php

at line 0 on your php script.

dunno I ain't a php man.

or

Code:
cat mail_in_file | [B]php[/B] ./mail_filter.php  root@example1.com john@example2.com

logged in as root eh?
 
At line 0..., it has always been there.
And I've solved this long ago and everything is working smoothly now.
Thanks!
 
Shell was one that echoed Syntax error: "(" unexpected, because it didn't liked a way PHP "treated" it.
So I've simply used other PHP function for comunnication with shell.
Instead of just executing command like you would
Code:
ls -al
, I've used PHP's popen to open pipe to sendmail
Code:
$po = popen(/usr/local/sbin/sendmail -some_param, 'w');
And then were writing mail to $po
Voila!
 
Back
Top