nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Paul Fox
Subject: Re: [Nmh-workers] draft validation, error checking
Date: Fri, 01 Jun 2012 13:26:38 -0400

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, address@hidden (arlington, ma, where it's 39.6 degrees)
 > 
 > _______________________________________________
 > Nmh-workers mailing list
 > address@hidden
 > https://lists.nongnu.org/mailman/listinfo/nmh-workers

=---------------------
 paul fox, address@hidden (arlington, ma, where it's 64.6 degrees)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]