Ver Fonte

try adding banner as multipart mixed MIME - when at top, only banner is displayed, when at bottom only mail body is displayed

Pi há 1 ano atrás
pai
commit
5af7ec7a6f
1 ficheiros alterados com 18 adições e 9 exclusões
  1. 18 9
      cropswap-sendmail.sh

+ 18 - 9
cropswap-sendmail.sh

@@ -12,24 +12,33 @@ if ((DEBUG != 0)); then
 	SENDMAIL="$DEBUGMAIL"
 fi
 
-cat - | formail -kb \
-	-X "MIME-Version:" \
-	-X "Content-Type:" \
-	-X "Subject:" \
-	-X "Date:" \
-> "${WD}/mail"
-subject="$(formail -cx "Subject:" < "${WD}/mail")"
+cat - > "${WD}/original"
+subject="$(reformail -c -x "Subject:" < "${WD}/original")"
 if [ "${subject/\[${SUBJECT}\]/}" == "${subject}" ]; then
 	subject="[${SUBJECT}] ${subject## }"
 fi
-formail \
+reformail \
+	-X "Date:" \
+	-X "MIME-Version:" \
 	-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" \
-< "${WD}/mail" | tail -n+2 > "${WD}/mail.new"
+	-X "List-Unsubscribe-Post:" \
+< "${WD}/original" > "${WD}/headers"
+
+reformime -s1 -e < "${WD}/original" | makemime -c "$(reformail -c -x 'Content-Type:' < "${WD}/original")" - > "${WD}/body"
+echo "NOTICE:======== <<<" | makemime -c "text/plain" - > "${WD}/banner"
+makemime -m multipart/mixed "${WD}/banner" > "${WD}/new"
+makemime -j "${WD}/new" "${WD}/body" | cat "${WD}/headers" - > "${WD}/mail.new"
+
 mv "${WD}"/mail{.new,}
 
 declare -A SUBSCRIBED