Procmail Recipie For FreeBSD Lists?
About a year or two ago, someone posted his recipe for sorting FreeBSD lists. This particular one was nice in that it extracted the list name from the "From" line (I think) and then created the appropriate folder if it didn't exist. So freebsd-questions list items were put in the 'questions' folder, freebsd-stable in the 'stable' folder, and so on. I have search the archives for this post for the past two days but have been unsuccessful. I've tried to write it myself but this is not my area of expertise. Does anyone have such a recipe they are willing to share? Thanks, Drew ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
Quoting Drew Tomlinson ([EMAIL PROTECTED]): | About a year or two ago, someone posted his recipe for sorting FreeBSD | lists. This particular one was nice in that it extracted the list name | from the "From" line (I think) and then created the appropriate folder | if it didn't exist. Probably the most appropriate field to match against in the mailheader is ``List-Id'', which for this mailinglist is: List-Id: User questions I do not have that particular script which you refer to, but I'd just like to give a note of warning on automatically executing shell commands based on email data (since an attacker could easily insert hazardous commands). Why not just have some extra lines in your procmailrc file? Also, I've written some notes on sorting incoming mail: "A guide to simple mail filtering on UNIX systems" http://csl.sublevel3.org/docs/mailfiltering.php -- Christian Stigen Larsen -- http://csl.sublevel3.org -- mob: +47 98 22 02 15 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
On Thu, Jul 03, 2003 at 08:53:30AM -0700, Drew Tomlinson wrote: > > About a year or two ago, someone posted his recipe for sorting FreeBSD > lists. This particular one was nice in that it extracted the list name > from the "From" line (I think) and then created the appropriate folder > if it didn't exist. So freebsd-questions list items were put in the > 'questions' folder, freebsd-stable in the 'stable' folder, and so on. I > have search the archives for this post for the past two days but have > been unsuccessful. I've tried to write it myself but this is not my > area of expertise. Does anyone have such a recipe they are willing to > share? Easy enough: :0: * List-Id:[^<]+<\/freebsd-[^.] $MATCH This will store each list in a folder prefixed by "freebsd-". If you want freebsd-questions to be stored in a folder named "questions", just move the \/ (which marks the beginning of the MATCH variable) to after the "freebsd-". And if you want it to support other RFC2919-compliant lists (that is, ones which include the "List-Id:" header), simply remove "freebsd-" from the recipe. -- Paul Chvostek <[EMAIL PROTECTED]> it.canadahttp://www.it.ca/ Free PHP web hosting!http://www.it.ca/web/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
Woops... On Thu, Jul 03, 2003 at 12:12:46PM -0400, Paul Chvostek wrote: > > Easy enough: > > :0: > * List-Id:[^<]+<\/freebsd-[^.] > $MATCH That should have been: :0: * ^List-Id:[^<]+<\/freebsd-[^.]+ $MATCH But I'm sure everyone already knew that... ;) -- Paul Chvostek <[EMAIL PROTECTED]> it.canadahttp://www.it.ca/ Free PHP web hosting!http://www.it.ca/web/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
in message <[EMAIL PROTECTED]>, wrote Drew Tomlinson thusly... > > About a year or two ago, someone posted his recipe for sorting FreeBSD > lists. This particular one was nice in that it extracted the list name > from the "From" line (I think) and then created the appropriate folder > if it didn't exist. So freebsd-questions list items were put in the > 'questions' folder, freebsd-stable in the 'stable' folder, and so on. I I use 'f-' named folder. Change the following (part of larger recipes) as you desire... # get list id :0 * ^List-ID:[]*.*\/<[a-z]+.*> { list_id = "$MATCH" } # identify other lists on different criteria # based on $list_id, assign $list # list= # freebsd lists :0 * list_id ?? ()<\/[a-z]+[-.a-z]+freebsd\.org> { # consider -gnats-submit list same as -bugs, but not -ports-bugs :0 * list_id ?? ()(ports-bugs|cvs-ports) { list = f-ports } :0 E * list_id ?? ()(gnats-submit|bugs) { list = f-bugs } # most interesting freebsd mailing lists :0 E * MATCH ?? ()\/(stable|ppc|cvs|mobile|questions|ports|java) { list = "f-${MATCH}" } # dafault $list for/from any freebsd list :0 E { list = f-misc } } # do other things # file message :0: * list ?? ^^f-[a-z]+^^ $list - Parv -- A programmer, budding Unix system administrator, and amateur photographer ISO employment... http://www103.pair.com/parv/work/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
- Original Message - From: "Paul Chvostek" <[EMAIL PROTECTED]> To: "Christian Stigen Larsen" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, July 03, 2003 9:12 AM > On Thu, Jul 03, 2003 at 08:53:30AM -0700, Drew Tomlinson wrote: > > > > About a year or two ago, someone posted his recipe for sorting FreeBSD > > lists. This particular one was nice in that it extracted the list name > > from the "From" line (I think) and then created the appropriate folder > > if it didn't exist. So freebsd-questions list items were put in the > > 'questions' folder, freebsd-stable in the 'stable' folder, and so on. I > > have search the archives for this post for the past two days but have > > been unsuccessful. I've tried to write it myself but this is not my > > area of expertise. Does anyone have such a recipe they are willing to > > share? > > Easy enough: > > :0: > * List-Id:[^<]+<\/freebsd-[^.] > $MATCH > > This will store each list in a folder prefixed by "freebsd-". If you > want freebsd-questions to be stored in a folder named "questions", just > move the \/ (which marks the beginning of the MATCH variable) to after > the "freebsd-". > > And if you want it to support other RFC2919-compliant lists (that is, > ones which include the "List-Id:" header), simply remove "freebsd-" from > the recipe. Thank you for your reply. I have tried implementing your suggestions to my specific environment but still do not have it quite right. I am using Maildir delivery to my home directory and also use Courier-IMAP. Thus a message to freebsd-questions ultimately needs to be delivered to Maildir/FreeBSD/Questions/new relative to my home directory. If this directory does not exist, I want it to be created. Based on your example, the messages were all added to a file called freebsd-questions in my home directory. I attempted to modify the recipe to achieve my desired results. Here's what I've put in my procmailrc: :0: * ^List-Id:[^<]+http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
On Thu, Jul 03, 2003 at 10:12:22AM -0700, Drew Tomlinson wrote: > > :0: > * ^List-Id:[^<]+ Maildir/FreeBSD/$MATCH/new > > And I'm getting messages like this in my procmail log: > > procmail: Assigning "PATH=/home/drew/bin:/bin:/usr/bin:/usr/local/bin" > procmail: Lock failure on "Maildir/FreeBSD/alpha/new.lock" > procmail: Error while writing to "Maildir/FreeBSD/alpha/new" > > OK, I assume the error is because Maildir/FreeBSD/alpha/new does not > exist. How can I get procmail to create the directory it needs? As you no doubt read on the procmail manpage: | If the mailbox name ends in "/", then this | directory is presumed to be a maildir folder; i.e., proc- | mail will deliver the message to a file in a subdirectory | named "tmp" and rename it to be inside a subdirectory | named "new". Now ... I obviously don't use maildir format, but to me, this would imply a format something like: :0 * ^List-Id:[^<]+ it.canadahttp://www.it.ca/ Free PHP web hosting!http://www.it.ca/web/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
- Original Message - From: "Paul Chvostek" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 03, 2003 10:37 AM > On Thu, Jul 03, 2003 at 10:12:22AM -0700, Drew Tomlinson wrote: > > > > :0: > > * ^List-Id:[^<]+ > Maildir/FreeBSD/$MATCH/new > > > > And I'm getting messages like this in my procmail log: > > > > procmail: Assigning "PATH=/home/drew/bin:/bin:/usr/bin:/usr/local/bin" > > procmail: Lock failure on "Maildir/FreeBSD/alpha/new.lock" > > procmail: Error while writing to "Maildir/FreeBSD/alpha/new" > > > > OK, I assume the error is because Maildir/FreeBSD/alpha/new does not > > exist. How can I get procmail to create the directory it needs? > > As you no doubt read on the procmail manpage: > > | If the mailbox name ends in "/", then this > | directory is presumed to be a maildir folder; i.e., proc- > | mail will deliver the message to a file in a subdirectory > | named "tmp" and rename it to be inside a subdirectory > | named "new". > > Now ... I obviously don't use maildir format, but to me, this would > imply a format something like: > > :0 > * ^List-Id:[^<]+ FreeBSD/$MATCH/ > > I'm assuming that the leading "Maildir/" is redundant, as is the pointer > to the "new" folder. Thanks for pointing out my oversight and all of the help so far. I've added the "/" and now my recipe is: :0 * ^List-Id:[^<]+http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists?
On Thu, Jul 03, 2003 at 02:26:49PM -0700, Drew Tomlinson wrote: > > > > :0 > > * ^List-Id:[^<]+ > FreeBSD/$MATCH/ > > Thanks for pointing out my oversight and all of the help so far. I've > added the "/" and now my recipe is: > > :0 > * ^List-Id:[^<]+ /Maildir/FreeBSD/$MATCH/ You're storing your Maildir in the root directory of the server? > However I get these messages from the procmail log: > > procmail: Matched "test" > procmail: Match on "^List-Id:[^<]+ procmail: Unable to treat as directory "/Maildir/FreeBSD/test" > procmail: Assigning "LASTFOLDER=/Maildir/FreeBSD/test" > procmail: Opening "/Maildir/FreeBSD/test" > procmail: Error while writing to "/Maildir/FreeBSD/test" It looks as if procmail doesn't have permissions to create directories in the root directory of your server. That's a Good Thing. > I've tried without the leading "/", without the Maildir, and without > "/Maildir/" but I keep getting the same type of error. Maildir is owned > by me and is mode 700. That's the right mode, but think about where the directory is, and where procmail wants to find out. Look in the procmail documentation (manpage for procmailrc) for variables like $DEFAULT, $MAILDIR, $HOME, etc. > If the mailbox is specified to be an MH folder or maildir folder, > procmail will create the necessary directories if they don't exist, > rather than treat the mailbox as a non-existent filename. > > I feel I am close. Can anyone enlighten me and point out what I'm > missing? Remember that paths that start with a / are absolute, and all other paths are relative to $MAILDIR. -- Paul Chvostek <[EMAIL PROTECTED]> it.canadahttp://www.it.ca/ Free PHP web hosting!http://www.it.ca/web/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Procmail Recipie For FreeBSD Lists? - SOLVED
- Original Message - From: "Paul Chvostek" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 03, 2003 2:48 PM Subject: Re: Procmail Recipie For FreeBSD Lists? > On Thu, Jul 03, 2003 at 02:26:49PM -0700, Drew Tomlinson wrote: > > > > > > :0 > > > * ^List-Id:[^<]+ > > FreeBSD/$MATCH/ > > > > Thanks for pointing out my oversight and all of the help so far. I've > > added the "/" and now my recipe is: > > > > :0 > > * ^List-Id:[^<]+ > /Maildir/FreeBSD/$MATCH/ > > You're storing your Maildir in the root directory of the server? > > > However I get these messages from the procmail log: > > > > procmail: Matched "test" > > procmail: Match on "^List-Id:[^<]+ > procmail: Unable to treat as directory "/Maildir/FreeBSD/test" > > procmail: Assigning "LASTFOLDER=/Maildir/FreeBSD/test" > > procmail: Opening "/Maildir/FreeBSD/test" > > procmail: Error while writing to "/Maildir/FreeBSD/test" > > It looks as if procmail doesn't have permissions to create directories > in the root directory of your server. That's a Good Thing. > > > I've tried without the leading "/", without the Maildir, and without > > "/Maildir/" but I keep getting the same type of error. Maildir is owned > > by me and is mode 700. > > That's the right mode, but think about where the directory is, and where > procmail wants to find out. Look in the procmail documentation (manpage > for procmailrc) for variables like $DEFAULT, $MAILDIR, $HOME, etc. > > > If the mailbox is specified to be an MH folder or maildir folder, > > procmail will create the necessary directories if they don't exist, > > rather than treat the mailbox as a non-existent filename. > > > > I feel I am close. Can anyone enlighten me and point out what I'm > > missing? > > Remember that paths that start with a / are absolute, and all other > paths are relative to $MAILDIR. Thanks for all of your help. I finally got it! The directory structure for Courier IMAP is Maildir equals INBOX. So in the IMAP client everything in $HOME/Maildir appears in the Inbox. Then any folders in the Inbox are stored in directories such as $HOME/Maildir/.folder.subfolder. In this case, the IMAP client Inbox would show one folder named "folder". Then in "folder" there would be "subfolder". So for me, I wanted questions list mail to get placed in $HOME/Maildir/FreeBSD.questions, stable list mail in $HOME/Maildir/FreeBSD.stable, etc. Since $MAILDIR is already defined as $HOME/Maildir, the correct recipe is as follows: :0 * ^List-Id:[^<]+http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"