tags:

views:

365

answers:

6

I've been trying to solve this for weeks...

My Goal is to search my inbox for the following messages:

Hello
Hi
Hey

Im using three files to do this for me. The first, a .forward file in my $HOME

"|IFS=' '&&exec usr/bin/procmail||exit 75 #username"

And these two are in my ~/.procmail directory

.procmailrc

VERBOSE=off
MAILDIR=$HOME/Mail
PMDIR=$HOME/.procmail
DEFAULT=/var/spool/mail/username
LOGFILE=$PMDIR/log
INCLUDERC=$PMDIR/general.rc
#end of .procmailrc

And lastly the rule file: general.rc

:0
* ^From:.*[email protected]
* ^Subject:.*hello
$HOME/Mail/Hello

What's supposed to happen is that all three of these files work together to copy and move mail that contain the hello pattern in its subject. And to be safe it will also look for a certain persons address. Then when those patterns are matched it will stick what it found and create the specified path; if it doesn't already exist.

But its not doing that. After I'm done editing these files in emacs, vi, .. and then save it, will it work automatically? Or do I need to compile it?

If I do, the .procmailrc might require ( if not all ) the 'Shell=/bin/sh'

Not that I didn't try that...

Please help.

+1  A: 

Procmail processes mail as it comes in, not when it's just sitting there in your mailbox. If you want to process mail that's already in your mailbox, you've got to pass it through procmail again, either by "bouncing" it to yourself, or by piping it through procmail. In a command line email client like mutt, you'd do the former with the 'b' command, and the latter by typing |procmail

Paul Tomblin
A: 

If you wish to process email you already have, you will need to:

  1. Exit any mail clients
  2. Move away your current Inbox (mv /var/spool/mail/username /tmp/mail.username )
  3. formail +1 -ds procmail < /tmp/mail.username
njsf
A: 

No, my poorly developed design is to process incoming mail..

I've tested it, by sending emails to myself.

What i think, is that my General.RC file isnt coded write. Because, directly after i send myself an email, it SHOULD copy and move it to the specified directory.

please edit your question if you want to clarify something!
hop
A: 
  1. Your ~.forward file has a missing '/' before usr. Also, you may keep it short like this;

    "| /usr/bin/procmail"

  2. put your .procmailrc under your HOME directory
  3. After setting your MAILDIR, write only "Hello" as the mailbox name in general.rc. Also use ":0:" at the beginning of the recipe to enable locking, all deliveries must lock the mailbox file!
  4. Make sure you have procmail installed at /usr/bin/procmail on the server.
  5. Make sure "Hello" file exists in your MAILDIR.
  6. Check the log file
hayalci
A: 

Its no wonder that i've made those mistakes, i've edited all three of these files a milllllion times.

Nothing is displayed in my LOG file...

I've fixed everything else and i know my /usr/bin/procmail exists because i used whereis to see its path.

But my testing still fails. I keep sending myself emails and checking my Mail Folder to see if the bytes in my "Hello" file have increased..

How can i get the log to work? Is the general.rc wrong?

if you edit your question and put your revised setup there, I would be glad to reexamine.
hayalci
A: 

I think your primary concern before any other debugging is to verify that procmail is being run on your incoming e-mail messages.

My suggestion is to make your .procmailrc file look like this (with nothing else)

VERBOSE=on
LOGFILE=/tmp/procmail.log

:0 fhbw
| sed "s/^Subject:/& --procmail working--/"

Then send yourself an e-mail message.

You should get a logfile in /tmp/procmail.log and your e-mail message should arrive in your mailbox with the subject line modified to include "--procmail working--".

If that doesn't work, then procmail is not being called and you should edit your question to show the current contents of your .forward file.

If that works, then the problem is with the contents of your .procmailrc or your general.rc file. You should edit your question to show the current contents of those two files.

--
bmb

bmb