Solved

.procmailrc recipe

Posted on 2004-10-27
326 Views
Last Modified: 2010-04-21
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


0
Question by:JAPerrett
    7 Comments
     

    Author Comment

    by:JAPerrett
    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?
    0
     
    LVL 5

    Accepted Solution

    by:
    FGREP="/usr/bin/fgrep"
    FGREP_OPTIONS="-i -s -f"
    OKFILE=$HOME/ok
    BANFILE=$HOME/banned

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

    # What do we do for un-verified senders.
    :0ch
    * ^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.
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    Have a look at the answer in http:Q_20035506.html
    0
     

    Author Comment

    by:JAPerrett
    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



    0
     
    LVL 5

    Expert Comment

    by:ITcrow
    Try something similar to:

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

    0
     
    LVL 38

    Assisted Solution

    by:yuzh
    Should be:

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

    Author Comment

    by:JAPerrett
    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.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    Suggested Solutions

    Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
    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…
    In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…
    Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    913 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now