nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] When a message goes only to me, as a cc

2016-11-15 11:12:07
Thank you. That helped a lot.

To get it to work, in addition to the  "-whom", I had to treat
"-dist" in a special way.

Ken Hornstein <kenh(_at_)pobox(_dot_)com> writes:
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I usually have a line, 'norm(_at_)dad(_dot_)org', in my drafts. I do that 
instead of
something like 'fcc: inbox', because I want to see what my Email looks li=
ke
after it has gone through the net. But sometimes I forget to otherwise ad=
dress
the message. But then send will just go ahead and send the message, inste=
ad of
balking, as it would if I used fcc instead of cc.

I think the simplest thing to do would be to write a custom postproc
and use it to interrogate the draft (using scan(1)) to make sure it was
the way you want.  Like if the To: line was blank, exit with a sensible
error message.  If you were happy with it, call the real post.

I've attached the sample postproc I put in the nmh contrib directory;
it's job is to change the switches to post depending on the from line,
but you could use it to see if there's something in the To: header.

--Ken

------- =_aaaaaaaaaa0
Content-Type: text/x-shellscript; charset="us-ascii"; name="localpostproc"
Content-Description: localpostproc
Content-Disposition: attachment; filename="localpostproc"
Content-Transfer-Encoding: quoted-printable

#!/bin/sh
#
# localpostproc - A sample postproc which changes the submission email ser=
ver
#                based on user-supplied criteria.
#
# The basic concept is that we change where we submit mail to based on the
# message contents.  We use scan(1) to get out fields we care about.  But
# really, you could use ANY criteria, such as environment variables,
# recipients, etc etc.
#

#
# Find out which message is the draft message; yes, this sucks.
#
# The case statement has to know about switches that take arguments;
# add to this list as necessary.
#

whom=3D0

find_draftmessage() {
while test $# -gt 0; do
case "$1" in
-al* | -filt* | -wi* | -client | -idanno | -server | \
-partno | -saslmech | -user | -por* | -width | \
-file* | -mhl* | -mt* | -cr* | -lib* | -auth* | -sendmail)
shift
;;
-whom)
whom=3D1
;;
-*)    ;;
*)     =

draftmessage=3D"$1"
return 0
;;
esac
shift
done

echo "Cannot find draft message name in argument list"
exit 1
}

realpost=3D"$(mhparam libdir)/post"

if [ $# -eq 0 ]; then
echo "Usage: [post switches] filename"
exit 1
fi
bmission"
;;

*)
echo "Don't know how to send email from $fromhost"
exit 1
;;
esac

exec "$realpost" $postflags "$@"

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

------- =_aaaaaaaaaa0--

    Norman Shapiro

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Nmh-workers] When a message goes only to me, as a cc, norm <=