procmail
[Top] [All Lists]

Re: Forwarding messages based on BODY

2001-08-18 12:16:28
* Jim Scott <jscott(_at_)infoconex(_dot_)com> [010818 03:31]:
Ok I found a good page to get me started.

http://www.stimpy.net/procmail/tutorial/

Here is what I have so far that worked.

:0c B
* TEST
test

:0a
!user(_at_)domain(_dot_)com

This copied the message to a folder called test and forwarded the message to
an email address.

How would I specify additional email addresses? Can I perhaps point to a
file that contained a list of email addresses to email to?

You can specify more than one email address w/ the !.  For example:

:0a
!user(_at_)domain(_dot_)com user2(_at_)domain(_dot_)com

I think you can do a shell command on the ! line too.  I seem to
remember this topic coming up before.  Perhaps check the mailing list
archives.

:0a
! `cat email_file`

Also if I am going to create one procmail file to detect any of the message
bodies how do I tell it that if it matches one of them to not test the
others? I found that the a tells it to run it if it matched the previous
test.

Perhaps set a variable when one matches.  Like this:

FLAG=off

:0Bc
* Generator Offline
* FLAG ?? off
{
    FLAG=on
    :0
    ! user(_at_)domain
}

:0Bc
* Power Down
* FLAG ?? off
{
    FLAG=on
    :0
    ! user(_at_)domain
}

etc

You may also want to check out the man pages for the use of the
'INCLUDERC' variable to save yourself from writing repetitive code.
That is if you decide to work off the above example.

Now the above just forwards what it received. How do I go about sending a
differnet message then what was sent or adding additional text to the
message?

You want to do an autoreply of some sort.  Check out 'man procmailex'
for a good example.

-- 
- Matt Dunford <> zoot(_at_)zotikos(_dot_)com ..
-. www.zotikos.com -- o,;-
        
Mr. `fortune` says:
People will accept your ideas much more readily if you tell them that
Benjamin Franklin said it first.
--
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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