When I pipe the output from printf to mail, the email does not get sent. When I write the output to a file and redirect input from the file, it works.
e.g. I have a bash script with the following:
printf "nsending email.n" | /usr/bin/mail -s "email test 1" id@domain-name.com
printf "nsending emailn" > /tmp/email-test
/usr/bin/mail -s "email test 2" id@domain-name.com < /tmp/email-test
email test 2 is delivered but email test 1 is not.
Why?
Using:
- GNU bash, version 4.4.20(1)-release
- postfix 3.3.0-1ubuntu0.2