diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-20 16:25:18 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-20 16:25:18 +0200 |
commit | 13165d7c4421b689c5ec1fc84f4b1573f5e9c400 (patch) | |
tree | fec2f3fdd5df9e7b217d42968db7ff4181080c6b /mcomp | |
parent | bb25a9d8a033bf81193fddedbe3770f34a42a494 (diff) | |
download | mblaze-13165d7c4421b689c5ec1fc84f4b1573f5e9c400.tar.gz mblaze-13165d7c4421b689c5ec1fc84f4b1573f5e9c400.tar.xz mblaze-13165d7c4421b689c5ec1fc84f4b1573f5e9c400.zip |
mcomp: first code to compose a mail
Diffstat (limited to 'mcomp')
-rwxr-xr-x | mcomp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/mcomp b/mcomp new file mode 100755 index 0000000..f4ce30c --- /dev/null +++ b/mcomp @@ -0,0 +1,51 @@ +#!/bin/sh +# mcomp [TO] - compose mail + +i=0 +while [ -f "snd.$i" ]; do + i=$((i+1)) +done +draft="snd.$i" + +{ + echo -n "To: $1" + [ "$#" -gt 1 ] && shift + for rcpt; do + echo -n ", $rcpt" + done + echo + echo "Cc: " + echo "Bcc: " + echo "Subject: " + cat ~/.santoku/headers 2>/dev/null + echo + echo + if [ -f ~/.signature ]; then + printf '%s\n' '-- ' + cat ~/.signature + fi +} >$draft + +c=e +while :; do + case "$c" in + s|send) + sendmail -t <$draft && rm $draft + exit $? + ;; + c|cancel) + echo "mcomp: cancelled draft $draft" + exit 1 + ;; + e|edit) + c= + if ! ${EDITOR:-vi} $draft; then + c=q + fi + ;; + *) + echo -n "What now? ([s]end, [c]ancel, [e]dit) " + read -r c + ;; + esac +done |