/** * vBulletin 3.8.8 Beta 1 CSS * Style: 'LQ Style - child of default'; Style ID: 7 */ @import url("http://www.linuxquestions.org/questions/clientscript/vbulletin_css/style-7eb8640c-00007.css"); procmail recipe to filter email to different folder
LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-26-2012, 10:00 PM   #1
newbie.my
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Rep: Reputation: Disabled
Question procmail recipe to filter email to different folder


Hi everyone,

The tittle said it all.
Currently my procmail recipe are as below:

Code:
FROM_=`formail -c -x"From "| awk '{ print $1 }'`

  SUBJ_=`formail -c -x"Subject:" | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

  :0
  *^Subject:.*(60)


  {
   :0 fwh
   | formail | (echo "$FROM_"; echo "$SUBJ_";)

   :0 fwb
   | formail -I ""


   :0
   myemail/
  }
My procmail recipe will only filter out the email that have number "60" it its subject.After that formail will execute taking out the information of the sender email and its subject before forwarding it together with its content to "myemail" folder.

Can someone help me to construct a procmail recipe to filtering incoming mails into different folders if there are multiple "60" seperated by commas in the subjects?

(For example,the email with subject 6010,6011,6012,.. the 6010 will go into 6010 folder,6011 will go into 6011 and so on.)

I really appreciate it if anybody can help me.Thanks.

Last edited by newbie.my; 12-26-2012 at 10:24 PM.
 
Old 12-28-2012, 08:36 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,457
Blog Entries: 54

Rep: Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897
I't s bit of a "greedy match" but can't you just use "*^Subject:.*60.*$"?
 
Old 12-30-2012, 10:46 PM   #3
newbie.my
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
I't s bit of a "greedy match" but can't you just use "*^Subject:.*60.*$"?
Yup..greedy match expression is what I'm looking for.
Btw the method that you suggest does not working.
Do you have any other suggestion?
Maybe there is another way to do this by phrasing the Subject information by using sed or awk before passing it to the procmail?
 
  


Reply

Tags
centos5, email, fetchmail, procmail


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Procmail Recipe: Need help vaibhavs Linux - Newbie 1 10-20-2009 01:59 PM
Anyone Filter Email w/ Procmail carlosinfl Linux - Server 10 03-14-2008 03:07 PM
Procmail recipe question gauge73 Linux - Software 3 05-03-2006 04:09 AM
Procmail recipe jebix666 Linux - General 1 06-09-2005 01:43 PM
MS Security Virus Email bypasses Procmail Filter lewt Linux - Security 3 09-24-2003 06:32 PM


All times are GMT -5. The time now is 08:33 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration