rp

simple email tools
git clone https://git.parazyd.org/rp
Log | Files | Refs | README | LICENSE

commit a06b231d6e15359eae4830f9bde2b3b7d953404b
parent 85d9b47d671498da153e2040ccac9ee5ec0c70f4
Author: parazyd <parazyd@dyne.org>
Date:   Sat, 28 Mar 2020 21:52:15 +0100

Rework rpcomp.

* Do not o unnecessary checks for Cc args.
* Use cat to print the initial headers rather than printf.

Diffstat:
Mbin/rpcomp | 43+++++++++++++++----------------------------
1 file changed, 15 insertions(+), 28 deletions(-)

diff --git a/bin/rpcomp b/bin/rpcomp @@ -1,43 +1,30 @@ #!/bin/sh -# -# Copy me if you can -# by parazyd -# profile="${RPPROFILE:-$HOME/.rp/default}" to="" -[ $# -gt 0 ] && to="$1" -[ $# -gt 1 ] && { - shift 1 - for i in "$@"; do - ccs="${ccs}${i}, " - done - ccs="$(echo "$ccs" | rev | cut -c3- | rev)" -} +if [ $# -gt 0 ]; then + to="$1" +fi -printf "Date: %s -From: %s +cat <<EOF +Date: $(LANG=C date -R) +From: $(rpheaders defaultfrom < "$profile/config") Subject: Subject -To: %s -Cc: %s +To: ${to} +Cc: Bcc: -Message-ID: %s +Message-ID: $(rputil -e genmsgid) User-Agent: rp MIME-Version: 1.0 -Content-Type: text/plain; charset=\"utf-8\" +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit +EOF +[ -e "$HOME/.mailheaders" ] && cat "$HOME/.mailheaders" -Text\\n\\n" \ - "$(LANG=C date "+%a, %d %b %Y %T %Z")" \ - "$(rpheaders defaultfrom < "$profile"/config)" \ - "$to" \ - "$ccs" \ - "$(rputil -e genmsgid)" +printf "\nText\n" -[ -e "$HOME/.signature" ] && { - printf -- "-- \\n" - cat "$HOME/.signature" -} +[ -e "$HOME/.signature" ] && cat "$HOME/.signature" exit 0