LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-10-2008, 10:59 PM   #1
linuxmaveric
Member
 
Registered: Aug 2007
Location: Southern California
Distribution: Ubuntu 8.04 for my desktop & FreeBSD 7.0 for my server blade.
Posts: 31

Rep: Reputation: 15
Need help with .procmailrc & regular expressions


How do I setup .procmailrc
to delete spam mail that comes from any addresses that end in .ch (.ch = email from china) and with the Subject "stocks or Stocks with a capital). Can someone help me out here with a critique and suggestions. Thanks.

I have here a sample procmail recipe that i came up with: Will this do the job or am I missing something?

:0
* ^From:.*.ch
* ^Subject:.*[Ss]tocks
/dev/null
 
Old 06-11-2008, 03:01 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Code:
* ^From:.*.ch
I think this will match any address at least 3 letters long with a "ch" in it. You probably want
Code:
* ^From:.*\.ch\>
I also think you will be better off using a spam filter instead of trying to write procmail rules to block spam for you.
 
Old 06-11-2008, 04:43 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread should be closed because it is a duplicate of http://www.linuxquestions.org/questi...mailrc-648414/ never mind the slightly different thread title.
 
Old 06-11-2008, 04:43 PM   #4
linuxmaveric
Member
 
Registered: Aug 2007
Location: Southern California
Distribution: Ubuntu 8.04 for my desktop & FreeBSD 7.0 for my server blade.
Posts: 31

Original Poster
Rep: Reputation: 15
Cool Need help with .procmailrc & regular expressions

Thanks "ntubski"

I tried out your code sample and it worked. I think your right a spam filter would probably be easier. Thanks for your suggestions.
RR
 
Old 06-11-2008, 04:48 PM   #5
linuxmaveric
Member
 
Registered: Aug 2007
Location: Southern California
Distribution: Ubuntu 8.04 for my desktop & FreeBSD 7.0 for my server blade.
Posts: 31

Original Poster
Rep: Reputation: 15
Unhappy Need help with .procmailrc & regular expressions

Sorry "unSpawn"

I did not mean to place the same post in 2 different sections. I was not getting any help in the "server section," so I placed my post here in programmers section. No need to get testy. Please remove my entry in the servers section if you wish. I would do it myself but I'm not sure if I can. I have been a member here for a while and I certainly am not trying to get myself kicked off.
RR.
 
Old 06-11-2008, 05:06 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Apology excepted. Next time just keep it at one thread and sit it out, OK?

Quote:
Originally Posted by linuxmaveric View Post
I have been a member here for a while and I certainly am not trying to get myself kicked off.
No, you won't be kicked *that* hard for something minor as this.

Last edited by unSpawn; 06-11-2008 at 05:10 PM.
 
  


Reply

Tags
procmail



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Regular expressions & search patterns LXer Syndicated Linux News 0 09-23-2007 02:51 AM
Regular Expressions markjuggles Programming 2 05-05-2005 11:39 AM
Regular expressions aromes Linux - General 1 10-15-2003 12:29 PM
regular expressions? alaios Linux - General 2 06-11-2003 03:51 PM
how to use expressions with pattern? .procmailrc realos Linux - Software 4 11-14-2002 10:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration