nmh-workers
[Top] [All Lists]

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

2016-10-11 10:26:17
norm(_at_)dad(_dot_)org wrote:
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 like
after it has gone through the net. But sometimes I forget to otherwise 
address
the message. But then send will just go ahead and send the message, instead 
of
balking, as it would if I used fcc instead of cc.

Is there a workaround that problem?

i do this using a wrapper for my editor program -- it runs some checks
on the draft (flags missing To: header, multiple From: headers, and
reports all Attach: headers) and emits stern warnings if something's
amiss.  they appear just above the whatnow prompt, and usually i
notice them.  :-) (in the past i've had code in there to force
confirmation, but that's disabled now.)  i also use it to check
that i'm not replying to an employer domain from a personal address.

i'm afraid it never occurred to me to use scan(1) to examine the draft,
so in the grand tradition of too many choices, i use grep, whom,
formail, and sed.  bad paul.  no donut.  i'll post my script here,
because i always learn something when ralph corrects my scripts.  ;-)

paul

final_checks()
{
    draft=$1
    if egrep -q '^(To:|Resent-To:)[[:space:]]*$' $draft ||
        ! egrep -q '^(To:|Resent-To:)' $draft
    then
        echo
        echo "ERROR: missing or empty 'To:' header...."
        return 1
    fi

    numfroms=$(sed -n -e '/^\(From:\|Resent-From:\)/p' -e '/^$/q' $draft |
        wc -l)
    if [ $numfroms != 1 ]
    then
        echo
        echo "ERROR: must have exactly one 'From:' header.  (has $numfroms)"
        return 1
    fi

    if am_pgf
    then
        tolap=$(whom $draft | grep ' at laptop\.org')
        fromfox=$(formail -c -x From: < $draft | egrep '@foxharp\.')
        if [ "$tolap" -a "$fromfox" ]
        then
            echo
            echo "WARNING!!!! message is 'To: laptop' and 'From: foxharp'"
        fi
    fi

    attachments=$(sed -n -e '/^Attach:/p' -e '/^$/q' $draft)
    if [ ! "$attachments" ]
    then
        echo No attachments
    else
        if echo "$attachments" | grep -q "Attach: [^/]"
        then
            echo "$attachments"
            echo "(pwd is $PWD)"
        else
            echo "$attachments"
        fi
    fi
    return 0
}


=----------------------
paul fox, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, where 
it's 51.8 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>