Go Back  FlyerTalk Forums > Travel&Dining > Travel Technology
Reload this Page >

Email filtering using procmail

Community
Wiki Posts
Search

Email filtering using procmail

Thread Tools
 
Search this Thread
 
Old Mar 23, 2011 | 4:54 pm
  #1  
Original Poster
30 Countries Visited
60 Nights
3M
20 Years on Site
 
Join Date: Apr 2003
Location: IAD
Programs: Free Agent
Posts: 1,959
Email filtering using procmail

I don't know why, but I still use Pine as my email client. Anyway, Spam Assassin works pretty well for me, but there are some domains that I'd like to block in my procmailrc file. How would I go about doing so? I tried the following recipe, but it didn't work:

:0:
* ^From: *lan.com
/dev/null

My only guess is that it's some syntax error. Any help would be appreciated! And no, I don't have anything against LAN. I just can't get off their mailing list for some reason.

Last edited by Condition One; Mar 23, 2011 at 4:59 pm
Condition One is offline  
Old Mar 23, 2011 | 5:32 pm
  #2  
All eyes on you!
15 Years on Site
 
Join Date: Dec 2006
Location: SNA
Programs: Bonvoy LTTE/AMB, AmEx Plat, National EE, WN A-List Preferred, CLEAR+, Covid-19, NK Gold
Posts: 5,272
Hey- I 99% use Pine, too.

But I think the issue is your leading "*" in your recipe; these aren't "glob"-type expressions, they're full regular expressions, and as such that "*" means "0 or more of the preceding match character", which in your case is the space.

I think:
Code:
:0:
* ^From:.*lan.com$
/dev/null
... will work, but for safety while testing change "/dev/null" to a folder so you don't inadvertently end up trashing all your mail.
kennycrudup is offline  
Old Mar 24, 2011 | 8:13 am
  #3  
Original Poster
30 Countries Visited
60 Nights
3M
20 Years on Site
 
Join Date: Apr 2003
Location: IAD
Programs: Free Agent
Posts: 1,959
Ah! I thought the "*" was a global expression. Alright, I made the change and we'll see if it works. Thanks!
Condition One is offline  
Old Oct 21, 2012 | 8:53 am
  #4  
Original Poster
30 Countries Visited
60 Nights
3M
20 Years on Site
 
Join Date: Apr 2003
Location: IAD
Programs: Free Agent
Posts: 1,959
Need some more help. So if I want to block a specific email address, is this correct?

:0:
* ^From:[email protected]
/dev/null


The thumbs up is supposed to be a caret by the way! Don't know how to disable that.
Condition One is offline  
Old Oct 21, 2012 | 9:15 am
  #5  
 
2M
All eyes on you!
25 Years on Site
 
Join Date: Nov 2000
Location: Upcountry Maui, HI
Posts: 13,708
You need something after the From: and before the spammers email address.

Code:
:0:
* ^From:[  ]*spammer@yahoo\.com
/dev/null
inside the square brackets you want a space followed by a tab. (I couldn't type a tab here.)

That will only match [email protected] and won't inadvertently match similar email addresses that end with the same string like [email protected]

the space tab inside the square brackets followed by the asterisk matches white space, so the expression matches "From:" at the beginning of the line, followed by zero or more white space characters, followed by [email protected]

You could use .* instead of the white space expression but that could produce some extra matches.

Anyway, try that, see if it works.

-David

Last edited by LIH Prem; Oct 21, 2012 at 10:55 am
LIH Prem is offline  
Old Oct 21, 2012 | 11:12 pm
  #6  
 
Join Date: Apr 2005
Location: PHX
Posts: 3,794
If you're using SpamAssassin, you can also use the blacklist_from option in its config file.

Code:
blacklist_from *@lan.com
For SpamAssasin, the * is just a regular wildcard, not a regular expression. You need to include the @ or you'll exclude all mail from any domain ending in ...lan.com, not just lan.com. For multiple domains, just use multiple blacklist_from lines.

This works by adding a very large value (100) to the spam score, so it will get filed according to how you're sorting your mail that's tagged as spam.

BTW, you can include special characters like ^ or :p without them being translated by checking the "Disable smilies in text" option in the "Additional Options" box below the submit/preview buttons.
alanh is offline  
Old Oct 23, 2012 | 6:10 am
  #7  
Original Poster
30 Countries Visited
60 Nights
3M
20 Years on Site
 
Join Date: Apr 2003
Location: IAD
Programs: Free Agent
Posts: 1,959
Ah, thanks for the tip on disabling smilies! I was looking for it near the top. Anyway, thanks for all your help! Things appear to be working. Is there a good tutorial on writing rules that you guys could point me towards?
Condition One is offline  
Old Oct 23, 2012 | 6:15 am
  #8  
 
Join Date: Oct 2011
Posts: 4,964
.....

Last edited by angatol; Feb 28, 2015 at 11:32 pm
angatol is offline  
Old Oct 23, 2012 | 8:33 am
  #9  
 
2M
All eyes on you!
25 Years on Site
 
Join Date: Nov 2000
Location: Upcountry Maui, HI
Posts: 13,708
Originally Posted by Condition One
Is there a good tutorial on writing rules that you guys could point me towards?
try this: http://userpages.umbc.edu/~ian/procmail.html

there's lots of examples out there. You might need to read up on "regular expressions" also if you really want to learn how to do it.

-David
LIH Prem is offline  


Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service -

This site is owned, operated, and maintained by MH Sub I, LLC dba Internet Brands. Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Designated trademarks are the property of their respective owners.