summaryrefslogtreecommitdiff
path: root/mailcert.sh
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2011-03-29 13:10:43 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2011-03-29 13:10:43 -0700
commitefc6bb97237a90f6017874346b12cfe9e8b2933d (patch)
tree1e279ffcc45f65c84203864c9e667eb64954838d /mailcert.sh
parent9684c8d5fbff056ad55902ecdf733ef08e848fd1 (diff)
downloadcash-efc6bb97237a90f6017874346b12cfe9e8b2933d.tar.gz
cash-efc6bb97237a90f6017874346b12cfe9e8b2933d.zip
mailcert.sh: switching subshell to heredoc for sendmail
Diffstat (limited to 'mailcert.sh')
-rwxr-xr-xmailcert.sh64
1 files changed, 31 insertions, 33 deletions
diff --git a/mailcert.sh b/mailcert.sh
index 167e571..6bbe890 100755
--- a/mailcert.sh
+++ b/mailcert.sh
@@ -68,38 +68,36 @@ export BOUNDARY="$(dd if=/dev/urandom bs=16 count=1 status=noxfer 2>/dev/null |
export USERCERTNAME=$(basename "$USERCERT")
export CACERTNAME=$(basename "$CACERT")
-(
- echo "To: $USEREMAIL"
- echo "From: $E"
- echo "Subject: Certificate from $CACN"
- echo "User-Agent: cash mailcert.sh"
- echo "MIME-Version: 1.0"
- echo "Content-Type: multipart/mixed; boundary=\"$BOUNDARY\""
- echo ""
- echo "This is a multipart message in MIME format."
- echo ""
- echo "--$BOUNDARY"
- echo "Content-Type: text/plain"
- echo "Content-Disposition: inline"
- echo ""
- echo "You'll want both of these."
- echo ""
- echo "$USERCERTNAME is your user certificate."
- echo ""
- echo "$CACERTNAME is the certificate authority certificate."
- echo "--$BOUNDARY"
- echo "Content-Type: application/x-x509-ca-cert"
- echo "Content-Disposition: attachment; filename=\"$USERCERTNAME\""
- echo ""
- cat "$CACERT"
- echo ""
- echo "--$BOUNDARY"
- echo "Content-Type: application/x-x509-ca-cert"
- echo "Content-Disposition: attachment; filename=\"$CACERTNAME\""
- echo ""
- cat "$USERCERT"
- echo ""
- echo "--$BOUNDARY--"
-) | /usr/lib/sendmail -t
+/usr/lib/sendmail << EOF
+To: $USEREMAIL
+From: $E
+Subject: Certificate from $CACN
+User-Agent: cash mailcert.sh
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="$BOUNDARY"
+
+This is a multipart message in MIME format.
+
+--$BOUNDARY
+Content-Type: text/plain
+Content-Disposition: inline
+
+You'll want both of these.
+
+$USERCERTNAME is your user certificate.
+
+$CACERTNAME is the certificate authority certificate.
+--$BOUNDARY
+Content-Type: application/x-x509-ca-cert
+Content-Disposition: attachment; filename="$USERCERTNAME"
+
+$(cat "$CACERT")
+--$BOUNDARY
+Content-Type: application/x-x509-ca-cert
+Content-Disposition: attachment; filename="$CACERTNAME"
+
+$(cat "$USERCERT")
+--$BOUNDARY--
+EOF
echo "Sent!"