nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] draft validation, error checking

2012-06-01 12:26:55

just closing off an old thread, since i finally found my tuit.

my problem was that i wanted to run validity checks on outgoing
mail, the failure of which would prevent the mail from being sent.

the (eventually) obvious, and simple, approach is to create
a wrapper for send, and assign it to sendproc.  the wrapper
does the validation checks, and only invokes send if they pass.
essentially:
        ...
        if [ "$1" = -force ]
        then
            shift
            send "$@"
        else
            final_checks "$@" && send "$@"
        fi
        exit

of course, final_checks needs to be able to pick the 'file'
argument out from any arguments that might be passed to send,
but if i'm passing any, i'll probably use the -force option as well.

paul


i wrote:
is there a way to set up a hook of some sort, either at the whatnow
level, or deeper in send or post, which will cause forbid sending, or
cause sending to fail, if a set of user-defined sanity checks
don't succeed?

i use a wrapper script for my editor in mh, and the script
prints warnings regarding the draft when the editor exits.  it
checks for things like a missing To: header at all, or if the
From: header looks like my home address but the To: header looks
like a work address -- that sort of thing.  when vi exits,
and i'm back at whatnow, i get this:

    WARNING:  missing or empty 'To:' header....
    What now?

and that's great, when i'm fully caffeinated and am actually paying
attention to what's on the screen.

i'd like to elevate at least some of those warnings to fatal errors --
i'd like to not be able to send the message until i fix the problem.

how might i do that?
 
paul
=---------------------
 paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, 
where it's 39.6 degrees)

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

=---------------------
 paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, 
where it's 64.6 degrees)

_______________________________________________
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] draft validation, error checking, Paul Fox <=