FlyerTalk Forums

FlyerTalk Forums (https://www.flyertalk.com/forum/index.php)
-   Travel Technology (https://www.flyertalk.com/forum/travel-technology-169/)
-   -   Email filtering using procmail (https://www.flyertalk.com/forum/travel-technology/1197743-email-filtering-using-procmail.html)

Condition One Mar 23, 2011 4:54 pm

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.

kennycrudup Mar 23, 2011 5:32 pm

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.

Condition One Mar 24, 2011 8:13 am

Ah! I thought the "*" was a global expression. Alright, I made the change and we'll see if it works. Thanks!

Condition One Oct 21, 2012 8:53 am

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.

LIH Prem Oct 21, 2012 9:15 am

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

alanh Oct 21, 2012 11:12 pm

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.

Condition One Oct 23, 2012 6:10 am

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?

angatol Oct 23, 2012 6:15 am

.....

LIH Prem Oct 23, 2012 8:33 am


Originally Posted by Condition One (Post 19548902)
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


All times are GMT -6. The time now is 2:16 pm.


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.