summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2017-02-17 15:46:24 (GMT)
committer Jaromil <jaromil@dyne.org>2017-02-17 15:46:24 (GMT)
commit845c5680cba7983c7027b2bdc4cbbc4361fb62f6 (patch)
tree84282f32808251ecda6eae6c617e7ad9cfdfa31f
parent39ddbf528a112388f06596a534dedd4eea821286 (diff)
compose from commandline now takes first line as subject
-rwxr-xr-xsrc/zlibs/email16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/zlibs/email b/src/zlibs/email
index da9edc5..620f058 100755
--- a/src/zlibs/email
+++ b/src/zlibs/email
@@ -25,8 +25,8 @@ compose() {
fn compose
# among the args parse recipient emails and files to attach
- _files=()
- _addrs=()
+ local _files=()
+ local _addrs=()
for p in ${PARAM}; do
if [[ -r $p ]]; then
func "attach: $p"
@@ -39,7 +39,17 @@ compose() {
fi
done
- cat | x_mutt ${=_files} -- ${=_addrs}
+ # 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}
+EOF
# _mutt -H <(print "To: ${PARAM[@]}")
return $?
}