procmail
[Top] [All Lists]

Re: Create new mail with procmail

1997-01-14 22:51:31
Alan K. Stebbens seems to have said:
I need a script that notifies my pager on incoming mails. I tried a cript
like :
:0 c
! my_pager(_at_)paging(_dot_)com

but it wouldn\xB4t work. So what I really need is a script that
creates a new mail using the old subject and leaving the body
blank (directed to my_pager(_at_)paging(_dot_)com).  Any ideas ? Thanks a lot
in advance !! Please reply to tihmann(_at_)on-luebeck(_dot_)de

Easy.

    :0 ciw
    * ^TO_$LOGNAME
    * !^Precedence: *(bulk|junk)
    * !^FROM_DAEMON
    * ^Subject: *\/[^ ].*
    | Mail -s "$MATCH" my_pager(_at_)paging(_dot_)com </dev/null

        procmail automatically quotes shell metas -- right?
        If so I guess this is safe enough.  


If you don't have "Mail", and wish to feed the mail directly to
Sendmail, use this recipe instead:
    :0 c      # fork a procmail subprocess
    * ^TO_$LOGNAME
    * !^Precedence: *(bulk|junk)
    * !^FROM_DAEMON
    * ^Subject: *\/[^ ].*
    { :0 fiw  # generate a mail 
      | echo "To: my_pager(_at_)paging(_dot_)com" ; echo "Subject: $MATCH" ; 
echo 
      :0      # send the mail
      ! -t
    }


        This seems a bit complicated.  What's wrong with:

     # ... same conditions
     * ^Subject: *\/[^ ].*
     | ( echo -e "To: mypager(_at_)paging(_dot_)com \nSubject: $MATCH\n") \
        | $SENDMAIL -t -oi
         
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

-- 
Jim Dennis,                                
info(_at_)mail(_dot_)starshine(_dot_)org
Proprietor,                          
consulting(_at_)mail(_dot_)starshine(_dot_)org
Starshine Technical Services              http://www.starshine.org