summaryrefslogtreecommitdiff
path: root/mailcert.sh
diff options
context:
space:
mode:
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!"