Re: Regex Help For Procmail
On 9/8/10 12:22 PM, Drew Tomlinson wrote: [snip] > # Deliver other email to folder > :0 > * ^From:.*famous-smoke\.com > "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" > > Do you see anything I'm missing? > Drew, I'll give this one final shot. Try this: * ^From:(@.*famous-smoke\.com) "$HOME/Maildir/" Regards, -- Glen Barber ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On 9/7/2010 5:50 PM, Robert Bonomi wrote: From owner-freebsd-questi...@freebsd.org Mon Sep 6 12:46:59 2010 Date: Mon, 06 Sep 2010 10:46:47 -0700 From: Drew Tomlinson To: per...@pluto.rain.com Cc: fr...@shute.org.uk, freebsd-questions@freebsd.org Subject: Re: Regex Help For Procmail On 9/5/2010 4:02 PM, per...@pluto.rain.com wrote: Frank Shute wrote: Drew, try this: * ^From:.*famous-smoke\.com I think it's not catching it because the period isn't backslash escaped ... Unless there's some edge case that I'm not thinking of, adding a backslash to escape a period will never convert a non-match into a match. An unescaped period in an RE matches any character, including a period. An escaped period matches only a period. I have confirmed this. I did add the backslash but procmail is still not matching. Adding the backslash _does_ better represent what the OP wants to accomplish, but the lack of it is not the cause of the RE not matching. (I'm not sufficiently familiar with how procmail uses REs to figure out what _is_ causing it not to match.) True and thus I'll leave the backslash. However I have no idea what _is_ causing it not to match either. I'm stumped. Chances are you're 'over-specifying' what you want. take off the trailing $, and maybe even the '>' There's _something_ in the header that is not what you 'think' it is, which is what is causing the problem. the difficulty is -finding- what that 'something' is. From whatever file procmail is dumping that message into, try using a minimal text editor (something that is *NOT* language/charset aware, delete everything _but_ that 'From: ' line, and then use that as input to 'od -xc' to see _exactly_ what's there. Here is that output: blacklamb> od -xc x 000 72466d6f203a46226d61756f20736d53 F r o m : " F a m o u s S m 020 6b6f20656853706f2022413c6e6e756f o k e S h o p " < A n n o u 040 636e40656d6569612e6c61666f6d7375 n c e @ e m a i l . f a m o u s 060 732d6f6d656b632e6d6f0a3e - s m o k e . c o m > \n And this procmail recipe does *not* match: # Deliver other email to folder :0 * ^From:.*famous-smoke\.com "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" Do you see anything I'm missing? Thanks, Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
> From owner-freebsd-questi...@freebsd.org Tue Sep 7 14:24:56 2010 > Date: Tue, 07 Sep 2010 12:01:40 +0200 > From: Bernt Hansson > To: Drew Tomlinson > Cc: fr...@shute.org.uk, per...@pluto.rain.com, freebsd-questions@freebsd.org > Subject: Re: Regex Help For Procmail > > 2010-09-06 19:46, Drew Tomlinson skrev: > > On 9/5/2010 4:02 PM, per...@pluto.rain.com wrote: > >> Frank Shute wrote: > >> > >>> Drew, try this: > >>> > >>> * ^From:.*famous-smoke\.com > >>> > >>> I think it's not catching it because the period isn't backslash > >>> escaped ... > >> Unless there's some edge case that I'm not thinking of, adding a > >> backslash to escape a period will never convert a non-match into > >> a match. An unescaped period in an RE matches any character, > >> including a period. An escaped period matches only a period. > > > > I have confirmed this. I did add the backslash but procmail is still not > > matching. > > > >> Adding the backslash _does_ better represent what the OP wants > >> to accomplish, but the lack of it is not the cause of the RE not > >> matching. (I'm not sufficiently familiar with how procmail uses > >> REs to figure out what _is_ causing it not to match.) > > > > True and thus I'll leave the backslash. However I have no idea what _is_ > > causing it not to match either. I'm stumped. > > I think it is the dash. Nope. dashes are 'special' *ONLY within a 'character class' (i.e., within square brackets). > Try to escape it like so: > > * ^From:.*famous\-smoke\.com > Z. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
2010-09-06 19:46, Drew Tomlinson skrev: On 9/5/2010 4:02 PM, per...@pluto.rain.com wrote: Frank Shute wrote: Drew, try this: * ^From:.*famous-smoke\.com I think it's not catching it because the period isn't backslash escaped ... Unless there's some edge case that I'm not thinking of, adding a backslash to escape a period will never convert a non-match into a match. An unescaped period in an RE matches any character, including a period. An escaped period matches only a period. I have confirmed this. I did add the backslash but procmail is still not matching. Adding the backslash _does_ better represent what the OP wants to accomplish, but the lack of it is not the cause of the RE not matching. (I'm not sufficiently familiar with how procmail uses REs to figure out what _is_ causing it not to match.) True and thus I'll leave the backslash. However I have no idea what _is_ causing it not to match either. I'm stumped. I think it is the dash. Try to escape it like so: * ^From:.*famous\-smoke\.com Thanks, Drew ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On 7-9-2010 3:51, Frank Shute wrote: > [snip] > I additionally don't like the look of your Maildir. It's quoted, you > should set MAILDIR in procmailrc, you should get rid of the space and > it should end in "new". Result: > > :0 > * ^From:.*famous-smoke\.com > .Shopping/Famous_Smoke/new I've actually never seen a recipe (either on the net, nor in the examples in procmailex suggesting this. The 'new' part is taken care of by procmail itself. > > I don't know what you're using for maildirmake but here's a script you > can adapt: > > > > #!/bin/sh > # > # Usage: maildirmake > > mkdir $1 > mkdir $1/new > mkdir $1/cur > mkdir $1/tmp > chown frank:frank $1/new > chown frank:frank $1/cur > chown frank:frank $1/tmp > chmod 700 $1 > chmod 700 $1/new > chmod 700 $1/cur > chmod 700 $1/tmp > > > > You have to run it from where you keep your maildirs i.e MAILDIR Also something procmail takes care of automatically. I've never created any directory structure for procmail to be able to deliver email to it. Peter -- http://www.boosten.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On Sun, Sep 05, 2010 at 09:33:31AM -0700, Drew Tomlinson wrote: > [snip] > > No, still not matching. Basically, why doesn't this header: > > From: "Famous Smoke Shop" > > Match this procmail recipe: > > :0 > * ^From:.*famous-smoke.com>$ > "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" > > From my procmail log: > > procmail: No match on "^From:.*famous-smoke.com>$" > > Thanks, > > Drew > I additionally don't like the look of your Maildir. It's quoted, you should set MAILDIR in procmailrc, you should get rid of the space and it should end in "new". Result: :0 * ^From:.*famous-smoke\.com .Shopping/Famous_Smoke/new I don't know what you're using for maildirmake but here's a script you can adapt: #!/bin/sh # # Usage: maildirmake mkdir $1 mkdir $1/new mkdir $1/cur mkdir $1/tmp chown frank:frank $1/new chown frank:frank $1/cur chown frank:frank $1/tmp chmod 700 $1 chmod 700 $1/new chmod 700 $1/cur chmod 700 $1/tmp You have to run it from where you keep your maildirs i.e MAILDIR So if you have your maildirs in Mail: $ cd ~/Mail $ mkdir .Shopping $ cd .Shopping $ maildirmake Famous_Smoke For your ref, here's my procmailrc PATH=/usr/local/bin SHELL=/bin/sh ORGMAIL=$HOME/Maildir/new PMDIR=$HOME/.procmail LOGFILE=$PMDIR/log VERBOSE=on MAILDIR=$HOME/Mail DEFAULT=$HOME/Maildir/new LOGNAME=frank INCLUDERC=$PMDIR/rules Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On 9/5/2010 2:32 PM, Glen Barber wrote: On 9/5/10 12:33 PM, Drew Tomlinson wrote: No, still not matching. Basically, why doesn't this header: From: "Famous Smoke Shop" Match this procmail recipe: :0 * ^From:.*famous-smoke.com>$ Hmm.. I just noticed this - I don't think you need the trailing bracket (>). What about this: * ^From:.*famous-smoke\.com$ Note that I also escaped the period before 'com'. I think I'd have to have the trailing bracket when specifying the "$" at the end. However maybe the bracket is some special regex character and needs to be escaped? I'm just going to remove the bracket and the $ and see what happens. However I *would* like to understand. Thanks for your help! Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On 9/5/2010 4:02 PM, per...@pluto.rain.com wrote: Frank Shute wrote: Drew, try this: * ^From:.*famous-smoke\.com I think it's not catching it because the period isn't backslash escaped ... Unless there's some edge case that I'm not thinking of, adding a backslash to escape a period will never convert a non-match into a match. An unescaped period in an RE matches any character, including a period. An escaped period matches only a period. I have confirmed this. I did add the backslash but procmail is still not matching. Adding the backslash _does_ better represent what the OP wants to accomplish, but the lack of it is not the cause of the RE not matching. (I'm not sufficiently familiar with how procmail uses REs to figure out what _is_ causing it not to match.) True and thus I'll leave the backslash. However I have no idea what _is_ causing it not to match either. I'm stumped. Thanks, Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
Frank Shute wrote: > Drew, try this: > > * ^From:.*famous-smoke\.com > > I think it's not catching it because the period isn't backslash > escaped ... Unless there's some edge case that I'm not thinking of, adding a backslash to escape a period will never convert a non-match into a match. An unescaped period in an RE matches any character, including a period. An escaped period matches only a period. Adding the backslash _does_ better represent what the OP wants to accomplish, but the lack of it is not the cause of the RE not matching. (I'm not sufficiently familiar with how procmail uses REs to figure out what _is_ causing it not to match.) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On 9/5/10 12:33 PM, Drew Tomlinson wrote: > No, still not matching. Basically, why doesn't this header: > > From: "Famous Smoke Shop" > > Match this procmail recipe: > > :0 > * ^From:.*famous-smoke.com>$ Hmm.. I just noticed this - I don't think you need the trailing bracket (>). What about this: * ^From:.*famous-smoke\.com$ Note that I also escaped the period before 'com'. -- Glen Barber ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On Sun, Sep 05, 2010 at 09:33:31AM -0700, Drew Tomlinson wrote: > [snip] > > No, still not matching. Basically, why doesn't this header: > > From: "Famous Smoke Shop" > > Match this procmail recipe: > > :0 > * ^From:.*famous-smoke.com>$ > "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" > > From my procmail log: > > procmail: No match on "^From:.*famous-smoke.com>$" > > Thanks, > > Drew Drew, try this: * ^From:.*famous-smoke\.com I think it's not catching it because the period isn't backslash escaped. Also don't bother catching the end of line as any whitespace there will screw up your re. Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
On 9/3/2010 2:12 PM, Drew Tomlinson wrote: Hi Glen, Thank you for your reply. On 9/3/2010 12:02 PM, Glen Barber wrote: Hi Drew, On 9/3/10 2:45 PM, Drew Tomlinson wrote: I use procmail for mail delivery and I'm trying to concoct the right regex to match From: headers and deliver to a folder. However mail is sent from various addresses so I want to match all that end with "famous-smoke.com>". Here's an example of a header: From: "Famous Smoke Shop" Because I also occasionally order, I don't want to catch mail from anything that has the word "Orders" and "Famous" in the From field. Thus here is my procmail recipe: # Deliver order info to inbox :0 *^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$ "${HOME}/Maildir/new/" Is this supposed to be "match Famous OR Order"? This currently matches "Famous AND Order". No, I want "Famous AND Order". # Deliver other email to folder :0 *^From:.*famous-smoke.com>$ "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" Going by your examples, you want to catch "Famous OR Order" and place that in Maildir/new, and all other email from this address to go to Maildir/.Shopping/... Try this: # catch "famous" or "order" :0 * ^From:.*([Ff]amous|[Oo]rder).*famous-smoke.com>$ "$HOME/Maildir/new" # catch everything else from this sender :0 * ^From:.*famous-smoke.com>$ "$HOME/Maildir/.Shopping/Famous Smoke/Email/" According to my procmail log, the From: header does not match. I would expect the example From: header above to match the second regex and be delivered to the specified folder. Where is my error? If my assumption above is incorrect, could you paste a snippet from your procmail log and point out what should be matching so we can have a specific example? This is the actual log entry from the example I used in this email: From annou...@email.famous-smoke.com Fri Sep 3 10:11:08 2010 Subject: Another Must-Attend Event at Famous! Folder: /home//Maildir/new/1283533874.95147_0.blacklamb. 8161 procmail: [95164] Fri Sep 3 10:13:05 2010 procmail: Assigning "NL= " procmail: Assigning "LOG= /home//Procmail/famous_smoke.rc" /home//Procmail/famous_smoke.rc procmail: No match on "^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$" procmail: No match on "^From:.*famous-smoke.com>$" procmail: Assigning "VERBOSE=OFF" I think my problem is that I was missing a "space" between "*" and "^From:". Your example shows a space and a reply from Brent Bloxam suggests this is the problem as well. I don't quite understand the difference between the two but have made the change and I'll see if it works. I'm also going to hit Google and see if I can understand. No, still not matching. Basically, why doesn't this header: From: "Famous Smoke Shop" Match this procmail recipe: :0 * ^From:.*famous-smoke.com>$ "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" From my procmail log: procmail: No match on "^From:.*famous-smoke.com>$" Thanks, Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
Hi Glen, Thank you for your reply. On 9/3/2010 12:02 PM, Glen Barber wrote: Hi Drew, On 9/3/10 2:45 PM, Drew Tomlinson wrote: I use procmail for mail delivery and I'm trying to concoct the right regex to match From: headers and deliver to a folder. However mail is sent from various addresses so I want to match all that end with "famous-smoke.com>". Here's an example of a header: From: "Famous Smoke Shop" Because I also occasionally order, I don't want to catch mail from anything that has the word "Orders" and "Famous" in the From field. Thus here is my procmail recipe: # Deliver order info to inbox :0 *^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$ "${HOME}/Maildir/new/" Is this supposed to be "match Famous OR Order"? This currently matches "Famous AND Order". No, I want "Famous AND Order". # Deliver other email to folder :0 *^From:.*famous-smoke.com>$ "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" Going by your examples, you want to catch "Famous OR Order" and place that in Maildir/new, and all other email from this address to go to Maildir/.Shopping/... Try this: # catch "famous" or "order" :0 * ^From:.*([Ff]amous|[Oo]rder).*famous-smoke.com>$ "$HOME/Maildir/new" # catch everything else from this sender :0 * ^From:.*famous-smoke.com>$ "$HOME/Maildir/.Shopping/Famous Smoke/Email/" According to my procmail log, the From: header does not match. I would expect the example From: header above to match the second regex and be delivered to the specified folder. Where is my error? If my assumption above is incorrect, could you paste a snippet from your procmail log and point out what should be matching so we can have a specific example? This is the actual log entry from the example I used in this email: From annou...@email.famous-smoke.com Fri Sep 3 10:11:08 2010 Subject: Another Must-Attend Event at Famous! Folder: /home//Maildir/new/1283533874.95147_0.blacklamb. 8161 procmail: [95164] Fri Sep 3 10:13:05 2010 procmail: Assigning "NL= " procmail: Assigning "LOG= /home//Procmail/famous_smoke.rc" /home//Procmail/famous_smoke.rc procmail: No match on "^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$" procmail: No match on "^From:.*famous-smoke.com>$" procmail: Assigning "VERBOSE=OFF" I think my problem is that I was missing a "space" between "*" and "^From:". Your example shows a space and a reply from Brent Bloxam suggests this is the problem as well. I don't quite understand the difference between the two but have made the change and I'll see if it works. I'm also going to hit Google and see if I can understand. Thanks again for your help! Cheers, Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Regex Help For Procmail
Hi Drew, On 9/3/10 2:45 PM, Drew Tomlinson wrote: > I use procmail for mail delivery and I'm trying to concoct the right > regex to match From: headers and deliver to a folder. However mail is > sent from various addresses so I want to match all that end with > "famous-smoke.com>". Here's an example of a header: > > From: "Famous Smoke Shop" > > Because I also occasionally order, I don't want to catch mail from > anything that has the word "Orders" and "Famous" in the From field. > Thus here is my procmail recipe: > > # Deliver order info to inbox > :0 > *^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$ > "${HOME}/Maildir/new/" > Is this supposed to be "match Famous OR Order"? This currently matches "Famous AND Order". > # Deliver other email to folder > :0 > *^From:.*famous-smoke.com>$ > "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" > Going by your examples, you want to catch "Famous OR Order" and place that in Maildir/new, and all other email from this address to go to Maildir/.Shopping/... Try this: # catch "famous" or "order" :0 * ^From:.*([Ff]amous|[Oo]rder).*famous-smoke.com>$ "$HOME/Maildir/new" # catch everything else from this sender :0 * ^From:.*famous-smoke.com>$ "$HOME/Maildir/.Shopping/Famous Smoke/Email/" > According to my procmail log, the From: header does not match. I would > expect the example From: header above to match the second regex and be > delivered to the specified folder. Where is my error? > If my assumption above is incorrect, could you paste a snippet from your procmail log and point out what should be matching so we can have a specific example? Regards, -- Glen Barber ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Regex Help For Procmail
I use procmail for mail delivery and I'm trying to concoct the right regex to match From: headers and deliver to a folder. However mail is sent from various addresses so I want to match all that end with "famous-smoke.com>". Here's an example of a header: From: "Famous Smoke Shop" Because I also occasionally order, I don't want to catch mail from anything that has the word "Orders" and "Famous" in the From field. Thus here is my procmail recipe: # Deliver order info to inbox :0 *^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$ "${HOME}/Maildir/new/" # Deliver other email to folder :0 *^From:.*famous-smoke.com>$ "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" According to my procmail log, the From: header does not match. I would expect the example From: header above to match the second regex and be delivered to the specified folder. Where is my error? Thanks, Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"