jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit 16a454b77e5b0e23899e7d499cebe2b598c02f31
parent 5902ddf2e37fb1cf572f8d55c771a41444569610
Author: Jaromil <jaromil@dyne.org>
Date:   Tue, 14 Mar 2017 08:02:09 +0100

add checks to cli send oneliners

Diffstat:
Msrc/zlibs/email | 27+++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/zlibs/email b/src/zlibs/email @@ -39,16 +39,23 @@ compose() { fi done - # take as subject the first line of body - ztmp - cat > $ztmpfile - local subject=`head -n1 $ztmpfile` - local nbsp=$'\255' - notice "Sending mail from commandline" - act "recipients: ${_addrs}" - [[ "$_files" = "" ]] || act "attachments: ${_files}" - act "subject: $subject" - cat <<EOF | x_mutt -s "${subject// /_}" -i $ztmpfile ${=_files} -- ${=_addrs} + # take as subject the first line of body + ztmp; body=$ztmpfile + if command -v rlwrap >/dev/null; then + rlwrap -c --multi-line -D2 -b '<>' -I -e '' cat > $body + else + cat > $body + fi + local subject=`head -n1 $body` + + [[ "$subject" = "" ]] && { + error "Nothing read from input, not even the subject" + return 1 } + notice "Sending mail from commandline" + act "recipients: ${_addrs}" + [[ "$_files" = "" ]] || act "attachments: ${_files}" + act "subject: $subject" + cat <<EOF | x_mutt -s "${subject// /_}" -i $ztmpfile ${=_files} -- ${=_addrs} EOF # _mutt -H <(print "To: ${PARAM[@]}") return $?