procmail
[Top] [All Lists]

Re: Help with auto-reply

1997-03-10 12:46:05

[Please keep your lines around 70 some characters long.]

David Vansickle <vansickd(_at_)Phibro(_dot_)COM> writes:
      I know that this SHOULD be easy but for some reason i am having lots of
 trouble  
with this. When a message comes into my mailbox with a subject of test, sent o
ut a  
message saying i recieve your message and then place the message into a mailbo
x.
      Well i can do each  of these task alone, but not together...
      
      If anyone has any good examples of this basic concept please feel free 
to e-mail  
them to me.


==============================================================================
=====
SENDMAIL=/usr/lib/sendmail
FORMAIL=/usr/local/bin/formail
:0
 * ^Subject: *test
 | ($FORMAIL -r -A"Precedence: LOW - You been auto-responded" -I"Subject: Ya 
ya I got  
your message";\
  cat /tmp/message.txt) | $SENDMAIL -ts

# More testing
:0:testing.lock
  * ^Subject.*xxx
  |appnmail IN.testing


Once procmail hits a delivering recipe, it stops processing your
.procmailrc, unless the recipe has the 'c' (for "copy") flag.  The
first of those recipes is a delivering recipe without the 'c' flag, so
procmail stops when it hits it.  Adding the 'c' flag will make procmail
keep going after sending the auto-reply so that it will process the
next recipe as well.

Some other comments...

I strongly recommend that you not hardcode paths to programs into your
.procmailrc.  Instead, make sure the requisite directories are in your
PATH and just call them without the path.  Thus, when formail is moved
to /usr/bin, your .procmailrc won't break.

The Precedence: header has traditionally been used by sendmail to mark
message priority.  I'd recommend not putting arbitrary text into it,
but using some other header for that, say, the Comments: header.

Is messages.txt really in /tmp?  What about when your machine is rebooted
and /tmp is cleared?  Why not $HOME/Mail/messages.txt?

The -s flag for sendmail is considered obsolete (-of is the modern
equivalent).  Do you really need it?  I've never seen a sendmail
setup that actually required it.

There's no point to the lockfile "testing.lock" as appnmail locks the
mailbox for you in the NeXT Mail.app fashion.  Given that Mail.app
doesn't pay attention to "testing.lock", why bother create it?


In sum:


PATH = /usr/local/bin:$PATH

:0 c
* ^Subject: *test
|(formail -rA"Precedence: junk" -A"Comments: This is an autoresponse" \
        -I"Subject: Ya ya, I got your message"; \
  cat /tmp/messages.txt) | $SENDMAIL -t

# presumably the conditions on this recipe will match anything that matched
# the preceeding recipe.
:0
* ^Subject:.*xxx
|appnmail IN.testing



Does that all make sense?

Philip Guenther