1

( GNU bash, version 4.2.50(1)-release (powerpc-ibm-aix6.1.2.0))

(
echo "a"
echo "b"
echo "c"
)| sendmail -F "Sender" recipients@a.com

This runs inside a .sh file, and the log (when ran with the -x option) show the sendmail before echo "c".

I am trying to debug why sendmail fails sporadically. Since the subshell and sendmail run in parallel, is it possible for sendmail to not wait for the whole subshell to be over, and use only the partial output until echo b and proceed to send an incomplete email and then fail? (There are no error messages in stderr though, the email just doesn't show up in my inbox mysteriously for some executions)

For more context: The echo commands I wrote above are just placeholders, I am actually trying to prepare an email as in this answer https://stackoverflow.com/a/3335377/11521011 and pipe it to sendmail

  • 2
    I'm guessing you're actual issue doesn't involve simply echoing a,b,c? There may be something else going on. Also what logs? – Jesse_b May 18 at 16:51
  • Also see In what order do piped commands run? – steeldriver May 18 at 17:22
  • @Jesse_b Thanks, I rephrased and added more context – dbza May 20 at 11:02
1

You have not used -i in sendmail's command line options.

Without it, sendmail treats a "single dot only line" as end of message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.