Forráskód Böngészése

reduce duplication of header references

Pi 1 éve
szülő
commit
b64b1ddf01
1 módosított fájl, 12 hozzáadás és 16 törlés
  1. 12 16
      cropswap-sendmail.sh

+ 12 - 16
cropswap-sendmail.sh

@@ -13,27 +13,16 @@ if ((DEBUG != 0)); then
 fi
 
 cat - > "${WD}/original"
-subject="$(reformail -c -x "Subject:" < "${WD}/original")"
-if [ "${subject/\[${SUBJECT}\]/}" == "${subject}" ]; then
-	subject="[${SUBJECT}] ${subject## }"
-fi
 reformail \
 	-X "Date:" \
 	-X "MIME-Version:" \
 	-X "Content-Type:" \
-	-I "Subject: ${subject}" \
 	-X "Subject:" \
-	-I "List-Id: $MAILGROUP" \
-	-X "List-Id:" \
-	-I "List-Unsubscribe: <mailto:$MAILGROUP?subject=[UNSUBSCRIBE]>" \
-	-X "List-Unsubscribe:" \
-	-I "List-Subscribe: <mailto:$MAILGROUP?subject=[SUBSCRIBE]>" \
-	-X "List-Subscribe:" \
-	-I "List-Post: <mailto:$MAILGROUP>" \
-	-X "List-Post:" \
-	-I "List-Unsubscribe-Post: List-Unsubscribe=One-Click" \
-	-X "List-Unsubscribe-Post:" \
 < "${WD}/original" > "${WD}/headers"
+subject="$(reformail -c -x "Subject:" < "${WD}/headers")"
+if [ "${subject/\[${SUBJECT}\]/}" == "${subject}" ]; then
+	subject="[${SUBJECT}] ${subject## }"
+fi
 
 # multipart/mixed isn't displaying all parts
 content_type="$(reformail -c -x 'Content-Type:' < "${WD}/original")"
@@ -46,7 +35,14 @@ content_type="$(reformail -c -x 'Content-Type:' < "${WD}/original")"
 #reformime -s1 -e < "${WD}/original" > "${WD}/body"
 #makemime -m "${content_type}" "${WD}/body" | cat "${WD}/headers" - > "${WD}/mail.new"
 
-reformime -s1 -e < "${WD}/original" | cat "${WD}/headers" - > "${WD}/mail.new"
+reformime -s1 -e < "${WD}/original" | cat "${WD}/headers" - | reformail \
+	-I "Subject: ${subject}" \
+	-I "List-Id: $MAILGROUP" \
+	-I "List-Unsubscribe: <mailto:$MAILGROUP?subject=[UNSUBSCRIBE]>" \
+	-I "List-Subscribe: <mailto:$MAILGROUP?subject=[SUBSCRIBE]>" \
+	-I "List-Post: <mailto:$MAILGROUP>" \
+	-I "List-Unsubscribe-Post: List-Unsubscribe=One-Click" \
+> "${WD}/mail.new"
 mv "${WD}"/mail{.new,}
 
 declare -A SUBSCRIBED