sh: 1: -t: not found

The problem

Recently I had to deal with a PHP script that was designed to run as a cron job. It does a simple processing: gets some data, creates a CSV file and sends the file using email.

When I manually ran it on the development environment everything went well except for the email not being sent and this strange line of text sneaked in the script’s output:

sh: 1: -t: not found

The email not being sent wasn’t a surprise, I knew that for some (technical or business) reason, the PHP code is unable to send emails from that particular machine. The strange error message (strange for me) is a different story. It was not generated by my code or by any of its dependencies.