procmail
[Top] [All Lists]

Re: Changing the subject

2015-10-05 20:05:38
"@lbutlr" <kremels(_at_)kreme(_dot_)com> writes:

On Sun Oct 04 2015 20:45:23 @lbutlr   <@lbutlr> said:OK, I fixed various 
typos and error and have something that is ALMOST working:

:0
* ARG ?? ^^alert^^
{
    VERBOSE=ON
    # SUBJECT=`formail -zx "Subject:"`
    TRAP='mv "$LASTFOLDER" "${LASTFOLDER}:2,S"'

    ;0cfwh
    BODYSUB=`formail -I ""`

    :0 hfw
    |formail -I"Subject: $BODYSUB"
    
    :0
    .alerts/
}

The trouble now is that BODYSUB begins with a <CR> so the subject shows up as 

Subject:
The body txt is here.

I'm not familiar with formail.  I assume that this usage of it removes
all of the headers, in which case, the remainder would start with an
empty line.  I assume you mean "BODYSUB begins with a <LF>...".

Why not just delete the empty line by using:

     BODYSUB=`formail -I "" | tail -n +2`

Of course, this turns the first line of the body into the subject line.
There will also be trouble if the body contains more than one line.

It would be easier to help you if you explained exactly the
transformation you want to accomplish, and also gave an example.

Dale
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>