From 1888a6885e0c4049755578814462cad4259e85df Mon Sep 17 00:00:00 2001 From: David Levine Date: Wed, 13 Jun 2012 23:12:22 -0500 Subject: [PATCH 1/1] Support empty message body in mhmail.in the same way as in mhmail. --- uip/mhmail.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/uip/mhmail.in b/uip/mhmail.in index 2caea10..56bcac0 100755 --- a/uip/mhmail.in +++ b/uip/mhmail.in @@ -84,6 +84,9 @@ else cclist="${cclist:+${cclist}, }${arg}"; ccarg=0 elif [ ${bodyarg} -eq 1 ]; then body=${arg}; bodyarg=0 + #### Allow -body "" by using just a newline for the body. + [ "${body}"x = x ] && body=" +" elif [ ${otherarg} -eq 1 ]; then #### Always end ${header} with a newline. header="${header:+${header} }${arg} @@ -109,9 +112,9 @@ else fi #### If no -body, read message from stdin the easy way. - if [ "${body}"x = x ]; then - body=`cat` - fi + [ "${body}"x = x ] && body=`cat` + #### Don't allow an empty body (from stdin). + [ "${body}"x = x ] && exit 1 #### Set up a tmpfil and trap to remove it. send moves the file to a backup. tmpdir=${MHTMPDIR:-${TMPDIR:-${TMP:-`${nmhbindir}/mhpath +`}}} -- 1.7.10.4