commit dffa957f76415ebf9672cc90bbc7d53ea7a3da09
parent d7ce38ced2811952bd0c716c2d2bf35ab2a6c7d5
Author: parazyd <parazyd@dyne.org>
Date: Mon, 12 Mar 2018 22:17:14 +0100
Style fixes to rpsend.
Diffstat:
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/bin/rpsend b/bin/rpsend
@@ -42,7 +42,7 @@ rnet="$(rpheaders rnet < $profile/config)"
rimap="$(echo $rnet | cut -d'!' -f2)"
ruser="$(rpheaders ruser < $profile/config)"
-echo " * smtp send via $rimap"
+printf "\n\n * smtp send via %s\n" "$rimap"
if ! [ -f "$profile/smtp-fingerprint" ]; then
echo " * no saved tls certificate fingerprint found. going with tofu."
@@ -52,14 +52,15 @@ fi
known="$(cat $profile/smtp-fingerprint)"
served="$(rputil -e getfpr "$rnet")"
-echo " * known fingerprint: $known"
-echo " * served fingerprint: $served"
-echo
-
if [ "$known" != "$served" ]; then
- echo " * server fingerprint mismatch!"
- echo " * the known one is different, this may be mitm"
- echo " * to trust the new one, edit or delete $profile/smtp-fingerprint"
+ cat <<EOF
+ * known fingerprint: $known
+ * served fingerprint: $served
+
+ * server fingerprint mismatch!"
+ * the known one is different, this may be mitm
+ * to trust the new one, edit or delete $profile/smtp-fingerprint
+EOF
exit 1
fi
@@ -81,9 +82,11 @@ EOF
_subj="$(printf "$email" | rpheaders Subject)"
_dest="$(printf "$email" | rpheaders To)"
-echo " * subject: $_subj"
-echo " * to: $_dest"
-echo " * sending $(rputil -e humansize $(printf "$email\n" | wc -c)) over the network"
+cat <<EOF
+ * subject: $_subj
+ * to: $_dest
+ * sending $(rputil -e humansize $(printf "$email\n" | wc -c)) over the network
+EOF
printf "$email\n" | \
msmtp $dryrun -C "$msmtpcfg" -t -X "$profile/tmp/msmtp.log"
@@ -98,8 +101,9 @@ case "$_e" in
;;
*)
echo " * msmtp failed"
- exit $_e;;
+ exit $_e
+ ;;
esac
# if successful, place into Sent
-echo "$email" | /usr/libexec/dovecot/deliver -m Sent
+printf "$email\n" | /usr/libexec/dovecot/deliver -m Sent