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\
In reply to Re: getting the correct 'from' field when sending mail
by gellyfish
in thread getting the correct 'from' field when sending mail
by dsm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |