Re: Issues with formal and cut?

Bart Schaefer <[email protected]> Wed, 14 May 2014 18:36:17 -0700
Newsgroups gmane.mail.procmail
Message-ID <CABkvzcvmv9P7K5fH5kqdUHKYBt4NKJbZF7w1AHvd7EbayariiQ@mail.gmail.com>
On Wed, May 14, 2014 at 10:33 AM, LuKreme <[email protected]> wrote:

>
> On 14 May 2014, at 11:16 , Bart Schaefer <[email protected]>
> wrote:
>
> > On Tue, May 13, 2014 at 10:13 PM, LuKreme <[email protected]> wrote:
> >
> > instead of getting the SMS text, I get the whole message. I suspect that
> flags for formail are incorrect, but it’s been so long since I used it.
> >
> >
> > I think you want :0ch so that formail gets only the header from procmail
> in the first place.
>
> I don’t want the headers from the email, I want the headers I set and the
> $SMSTEXT.
>

Well, yes, but formail works by examining the header of an input email, and
if you use the "|" action in the recipe procmail is always going to send
some part of the current message as the standard input of the pipe.  The
body, formail just passes through without changing.  So if you don't want
the body, tell procmail not to send it, regardless of what you're going to
do with the header.  Otherwise you're just making formail consume and
discard input that you don't care about.


> Right now, this seems to be working
>
> :0c
>       | (formail -brt -I"Subject: ${CLEANFROM}" \
>         -I"To: ${BOXCAR}" \
>         -I"From: [email protected]"; \
>         echo $SMSTEXT) | $SENDMAIL -t
>

The -r option causes formail to throw away its entire input and produce
To/Subject/In-Reply-To/References as ouput.  You then clobber To/Subject
with your -I options.  Unless you need In-Reply-To for some reason, you may
as well not pipe to formail at all:

  SENDM=`(echo "From: [email protected]"; \
          echo "To: ${BOXCAR}"; \
          echo "Subject: ${CLEANFROM}"; \
          echo ""; \
          echo "$SMSTEXT") | $SENDMAIL -t`

(I didn't actually test that, but I believe it'll do what you want.)

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail