LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 07-12-2005, 12:51 PM   #1
Ratclaws
Member
 
Registered: Sep 2001
Location: New York
Distribution: Slackware 8
Posts: 100

Rep: Reputation: 16
Procmail - help w/ recipe to sort mailer-daemons


First off: go easy, I'm a procmail newb

I've been playing with my .procmailrc for a few days now, but I just can't
seem to get my recipe working.
I almost had it at one point, but accidentally deleted my .procmailrc when
trying to clear out my procmail.log

Can anyone help out with this?? I know I got a lot of my ":0 *"'s screwed
up. I've been RTFM'ing for quite some time now, but im just stuck....

I'll just comment what im attempting in the below .procmailrc file.
~mailsort/.procmailrc
Code:
######### .procmailrc ################
SHELL=/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:
SENDMAIL=/usr/sbin/sendmail
VERBOSE=on
LOGFILE=$HOME/procmail.log
UMASK=077
LOCKTIMEOUT=1024
TIMEOUT=960
SUSPEND=16
LINEBUF=4096
NL="
"


#   Check to see if my Loop tag is in there. If it is, then I want to
mark
#   this message as a problem
#
:0 fhw:
* ^X-DR-Loop: TAGGED
* ^Subject:\/.*
    {
        LOG = "Caught a Loop $NL"
        |formail -I "Subject: PM-Rule DR-Loop-> $MATCH"
    }


# otherwise, add the TAG
:0 c:
*
    {
        LOG = "Adding at Loop tag"
        |formail -A "X-DR-Loop: TAGGED"
    }
#########################################################3



####################################
# Catch some auto responses messages
#
:0 fh w
* ^Auto-Submitted: auto-generated(failure)
* ^Subject:\/.*
    {
       LOG = "PM 1 was hit"
       |formail -I "Subject: PM-Rule 1 -> $MATCH"
    }

:0 fh w
* ^Content-Type: multipart/report; report-type=delivery-status;
* ^Subject:\/.*
    {
        LOG = "PM 2 was hit"
        |formail -I "Subject: PM-Rule 2 -> $MATCH"
    }

:0 fh w
* ^_MAILER
* ^Subject:\/.*
    {
        LOG = "PM 3 was hit"
        |formail -I "Subject: PM-Rule 3 -> $MATCH"
    }
######################################################





#####################################################
#  Collect any messages that are marked as a problem,
#  and send it to my address
#
:0
* ^Subject: PM-Rule*
    {
        LOG="Matched a PM Rule $NL"
        !catchall@example.com
    }



#######################################################3
#
#   Finally, any message that made it this far should be marked with
#   my loop and then resent to the same account.
#   ie. When i recieve the message, i want the subject to say:
#   PM-Rule  MY-Loop-> subject
#
:0:
*
    {
        !mailsort
    }
### Eventually this will be forwarding to someone elses address,
### but for now I want to see if any bounc messages
### make it past my filter.
And here is my ~mailsort/procmail.log
----- SNIP -----
Code:
######### procmail.log ###############
procmail: Assigning "UMASK=077"
procmail: Assigning "LOCKTIMEOUT=1024"
procmail: Assigning "TIMEOUT=960"
procmail: Assigning "SUSPEND=16"
procmail: Assigning "LINEBUF=4096"
procmail: No match on "^X-DR-Loop: TAGGED"
procmail: Extraneous filter-flag ignored
procmail: Extraneous locallockfile ignored
procmail: Extraneous deliver-head flag ignored
procmail: Skipped "|formail -I "Subject: PM-Rule DR-Loop-> $MATCH""
procmail: Match on ""
procmail: Locking ".lock"
procmail: Forking "procmail"
procmail: [6548] Tue Jul 12 14:19:29 2005
procmail: Assigning "LOG=Adding at Loop tag"
Adding at Loop tag
procmail: Skipped "|formail -A "X-DR-Loop: TAGGED""
procmail: No match on "^Auto-Submitted: auto-generated(failure)"
procmail: Extraneous filter-flag ignored
procmail: Extraneous deliver-head flag ignored

Last edited by Ratclaws; 07-12-2005 at 01:29 PM.
 
Old 07-12-2005, 04:17 PM   #2
Ratclaws
Member
 
Registered: Sep 2001
Location: New York
Distribution: Slackware 8
Posts: 100

Original Poster
Rep: Reputation: 16
SOLVED !

here is the new .procmailrc
Code:
SHELL=/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:
SENDMAIL=/usr/sbin/sendmail
VERBOSE=on
LOGFILE=$HOME/procmail.log
UMASK=077
LOCKTIMEOUT=1024
TIMEOUT=960
SUSPEND=16
LINEBUF=4096
NL="
"


#   Check to see if my Loop tag is in there. If it is, then I want to mark
#   this message as a problem
#
:0
* ^X-DR-Loop: TAGGED
* ^Subject:\/.*
    {
        LOG = "Caught a Loop $NL"
        :0 fhw
        |formail -I "Subject: PM-Rule DR-Loop-> $MATCH"
    }


# otherwise, add the TAG
:0
* !^X-DR-Loop: TAGGED
    {
        LOG = "Adding a Loop tag$NL"
        :0 fhw
        |formail -A "X-DR-Loop: TAGGED"
    }
#########################################################3



####################################
# Catch some auto responses messages
#
:0
* ^Auto-Submitted: auto-generated\(failure\)
* ^Subject:\/.*
    {
        LOG = "PM 1 was hit$NL"
        :0 fhw
        |formail -I "Subject: PM-Rule 1 -> $MATCH"
    }

:0
* ^Content-Type: multipart/report; report-type=delivery-status;
* ^Subject:\/.*
    {
        LOG = "PM 2 was hit$NL"
        :0 fhw
        |formail -I "Subject: PM-Rule 2 -> $MATCH"
    }

:0
* ^FROM_MAILER
* ^Subject:\/.*
    {
        LOG = "PM 3 was hit$NL"
        :0 fhw
        |formail -I "Subject: PM-Rule 3 -> $MATCH"
    }
######################################################





#####################################################
#  Collect any messages that are marked as a problem,
#  and send it to my address
#
:0
* ^Subject: PM-Rule*
    {
        LOG="Matched a PM Rule $NL"
        :0
        !catchall@example.com
    }



#######################################################3
#
#   Finally, any message that made it this far should be marked with
#   my loop and then resent to the same account.
#   ie. When i recieve the message, i want the subject to say:
#   PM-Rule  MY-Loop-> subject
#

:0
*
    {

        LOG = "Passed All Filters$NL"
        :0 fhw
        * ^Subject:\/.*
        |formail -I "Subject: PASSED Filter -> $MATCH"

        :0
        !catchall@example.com
    }
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Three actions in a recipe of Procmail Borelian Linux - Software 1 11-11-2012 06:48 AM
what is wrong with this regular expression in procmail recipe? realos Linux - Software 4 10-20-2005 09:35 AM
Procmail recipe jebix666 Linux - General 1 06-09-2005 01:43 PM
procmail recipe for charset conversion Peff Linux - Software 0 07-13-2004 02:40 AM
procmail recipe not working? theLIGHT Linux - Software 3 11-18-2002 10:04 PM


All times are GMT -5. The time now is 07:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration