[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


.procmailrc recipe

Posted on 2004-10-27
Medium Priority
Last Modified: 2010-04-21
here is the basis for what I want as a procmail recipe

FROM='formail -x From:'

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

(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

Question by:JAPerrett
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2

Author Comment

ID: 12422410
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

 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?

Accepted Solution

ITcrow earned 500 total points
ID: 12431135
FGREP_OPTIONS="-i -s -f"

# What do we do for banned senders.
* ? (formail -xFrom:) | $FGREP $FGREP_OPTIONS $BANFILE
.... Do something here ....

# What do we do for un-verified senders.
* ^X-Sender-Verify:.*could not be verified
* ! ? (formail -xFrom:) | $FGREP $FGREP_OPTIONS $OKFILE
.... Do something here ....

You can even combine the two. fgrep has '-v' which returns back stuff that is not matched.
But, in the receipe you have "* !" which means receipe is accepted if the condition fails.
LVL 38

Expert Comment

ID: 12431221
Have a look at the answer in http:Q_20035506.html
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.


Author Comment

ID: 12432562
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
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


Expert Comment

ID: 12437509
Try something similar to:

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

LVL 38

Assisted Solution

yuzh earned 500 total points
ID: 12440849
Should be:

FROM='formail -x From:'|/bin/cut -f2 -d'@' # you get easyjet.com
FROM="@${FROM}"  # make @easyjet.com

Author Comment

ID: 12884464
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.

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question