EOF
run_test "send -draft -server 127.0.0.1 -port $localport" \
- "post: message has no From: header
+ "post: message has no From: header
post: See default components files for examples
post: re-format message and try again
send: message not delivered to anyone"
+#
+# Make sure that empty Nmh-* header lines are ignored, and that post
+# warns about non-empty ones.
+#
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody <nobody@example.com>
+To: Somebody Else <somebody@example.com>
+Nmh-Attachment:
+Nmh-Unused: suppress this line
+Subject: Test
+
+This is a test
+.
+EOF
+
+cat > "${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<nobody@example.com>
+RCPT TO:<somebody@example.com>
+DATA
+From: Mr Nobody <nobody@example.com>
+To: Somebody Else <somebody@example.com>
+Subject: Test
+Date:
+
+This is a test
+..
+.
+QUIT
+EOF
+
+cat > "${testname}.expected_send_output" <<EOF
+post: ignoring header line -- Nmh-Unused: suppress this line
+EOF
+
+test_post "${testname}.actual" "${testname}.expected" \
+ >${testname}.send_output 2>&1
+
+check "${testname}.send_output" "${testname}.expected_send_output"
+
+
exit ${failed:-0}
# retry a few times if it fails...
status=1
for i in 0 1 2 3 4 5 6 7 8 9; do
- if send -draft -server 127.0.0.1 -port $localport $3 >/dev/null 2>&1
+ if send -draft -server 127.0.0.1 -port $localport $3
then
status=0
break
}
if ((i = get_header (name, hdrtab)) == NOTOK) {
- fprintf (out, "%s: %s", name, str);
+ if (strncasecmp (name, "nmh-", 4)) {
+ fprintf (out, "%s: %s", name, str);
+ } else {
+ /* Filter out all Nmh-* headers, because Norm asked. They
+ should never have reached this point. Warn about any
+ that are non-empty. */
+ if (strcmp (str, "\n")) {
+ char *newline = strchr (str, '\n');
+ if (newline) *newline = '\0';
+ if (! whomsw) {
+ advise (NULL, "ignoring header line -- %s: %s", name, str);
+ }
+ }
+ }
+
return;
}