Link to home
Start Free TrialLog in
Avatar of JAPerrett
JAPerrett

asked on

.procmailrc recipe

here is the basis for what I want as a procmail recipe

FGREP=/usr/bin/fgrep
FROM='formail -x From:'

:0
* ^X-Sender-Verify:.*could not be verified
!* ? (echo "$FROM" | $FGREP -i -f $HOME/ok
 !junkmail

(taken from http://handsonhowto.com - thank you very much btw - got me most of the way to what I want)
what I want to do is junk any emails with the 'could not be verified' string in header if not in the ok file. I want to be able to enter generic addresses such as *@easyjet.com

will the above recipe work and continue to process other recipes for such an email.


If I have this request in the wrong section , let me know - it's the nearest I could find - thanks


Avatar of JAPerrett
JAPerrett

ASKER

been trying at command line with grep, egrep, fgrep, but test seems to be opposite way round to what I want
with file ok containing
@easyjet.com

 when I type fgrep -i "jet.com" ok
it echos the line @easyjet.com , cos jet.com is in @easyjet.com
what I want is the reverse check where I check for the existanse of the line in the file within my pattern entry. is there such a command?
ASKER CERTIFIED SOLUTION
Avatar of ITcrow
ITcrow

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yuzh
Have a look at the answer in http:Q_20035506.html
the concept i have is

* ^X-Sender-Verify:.*could not be verified
if the heading X-Sender-Verify indicates that the email cannot be verified
!* ? (echo "$FROM" | $FGREP -i -f $HOME/ok
and the sender is not in the accepted list
 !junkmail
dump it to junkmail

otherwise accept and process as normal - sending it to the desired recipient with a later recipe

hence the !
and I'm ok with that, (or at least It seems logical to me)


the problem I am trying to resolve, is that if my $HOME/ok file conains exact matches, then it will work,
but what I want is to find a match with fgrep/another program
that will match newsletter@easyjet.com in $FROM with *@easyjet.com in the ok file, and this is the bit I am struggling with



Try something similar to:

FROM='formail -x From:'|/bin/cut -f1 -d'@'
FROM=@$FROM

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry I left it so long - other things got a higher priority - plus been away a bit. - Thanks for the feedback everyone.. I have read the answers now, and sorry I left it to admin to clear up the points.