in reply to getting the correct 'from' field when sending mail
I think you will find that it is because you are not chomping the data read from INFILE - this causes the To: header to have an additional newline which is interpreted as the end of the headers
/J\
|
|---|