numbers as, for example, "10K", or "2.3Mi"
- Support for the -sendmail flag to send/post to change the sendmail
binary when using the sendmail/pipe MTS.
+- Added support to send(1) to specify switches to post(1) based on address or
+ domain name in From: header line in message draft.
-----------------
OBSOLETE FEATURES
#### that they are set here so that individual tests can be run
#### outside of make. Requires that MH_OBJ_DIR be set on entry.
test -z "$MH_TEST_DIR" && MH_TEST_DIR="$MH_OBJ_DIR/test/testdir"
+export MH_TEST_DIR
test -z "$MH_INST_DIR" && MH_INST_DIR="${MH_TEST_DIR}/inst"
test -z "$MH_VERSION" && MH_VERSION="@VERSION@"
test -z "$prefix" && prefix=@prefix@
Date: Fri, 29 Sep 2006 00:00:00
Message-Id: 1@test.nmh
Subject: Testing message 1
-Resent-From: =?UTF-8?Q?Mr_F=C3=B8o_Bar?= <foo@bar.com>
-Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= <nobody@nowhere.com>
+Resent-From: =?UTF-8?Q?Mr_F=C3=B8o_Bar?= <resent-from@example.com>
+Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= <resent-to@example.com>
Resent-Date:
This is message number 1
EOF
-test_dist +inbox 1 -noedit -from 'Mr Føo Bar <foo@bar.com>' \
- -to 'Mr Nobodÿ <nobody@nowhere.com>' -fcc +outbox
+test_dist +inbox 1 -noedit -from 'Mr Føo Bar <resent-from@example.com>' \
+ -to 'Mr Nobodÿ <resent-to@example.com>' -fcc +outbox
exit ${failed:-0}
return NOTOK;
}
- if ((in = fopen(filename, "r")) != NULL) {
- char *addrformat = "%(addr{from})", *hostformat = "%(host{from})";
-
- if ((*addr = get_message_header_info(in, addrformat)) == NULL) {
- *message = "unable to find From: address in";
- return NOTOK;
+ if ((in = fopen (filename, "r")) != NULL) {
+ /* There must be a non-blank Envelope-From or {Resent-}Sender or
+ {Resent-}From header. */
+ char *addrformat = "%(addr{Envelope-From})";
+ char *hostformat = "%(host{Envelope-From})";
+
+ if ((*addr = get_message_header_info (in, addrformat)) == NULL ||
+ strlen (*addr) == 0) {
+ addrformat = distfile == NULL ? "%(addr{Sender})" : "%(addr{Resent-Sender})";
+ hostformat = distfile == NULL ? "%(host{Sender})" : "%(host{Resent-Sender})";
+
+ if ((*addr = get_message_header_info (in, addrformat)) == NULL) {
+ addrformat = distfile == NULL ? "%(addr{From})" : "%(addr{Resent-From})";
+ hostformat = distfile == NULL ? "%(host{From})" : "%(host{Resent-From})";
+
+ if ((*addr = get_message_header_info (in, addrformat)) == NULL) {
+ *message = "unable to find sender address in";
+ fclose(in);
+ return NOTOK;
+ }
+ }
}
- rewind(in);
+ /* Use the hostformat that corresponds to the successful addrformat. */
if ((*host = get_message_header_info(in, hostformat)) == NULL) {
fclose(in);
- *message = "unable to find From: host in";
+ *message = "unable to find sender host in";
+ fclose(in);
return NOTOK;
}
fclose(in);
/*
* Read in the message and process the header.
*/
+ rewind (in);
parsing_header = 1;
do {
char name[NAMESZ], rbuf[NMH_BUFSIZ];
/* Trim trailing newline, if any. */
retval = rtrim(charstring_buffer_copy((buffer)));
charstring_free(buffer);
-
- return retval;
+ if (strlen (retval) > 0) {
+ return retval;
+ } else {
+ free (retval);
+ return NULL;
+ }
}