Professional Web Applications Themes

Procmail Problem - Linux / Unix Administration

Hi all, I am sorry if this is not the right forum for this sort of question, it seemed the best match from the forums I had on offer. Hopefully I will be able to find someone who can help. I have no real experience with 'nix, but do have a shared (Red Hat I think?) hosting account. I am trying to set up a promailrc file to direct incoming mail to a script. This works fine when I don't use conditionals: :0 | /usr/bin/php /home/myaccount/myscript However, all conditionals seem to fail.... :0 * Subject.*urgent | /usr/bin/php /home/myaccount/myscript I have ...

  1. #1

    Default Procmail Problem

    Hi all,

    I am sorry if this is not the right forum for this sort of question, it
    seemed the best match from the forums I had on offer. Hopefully I will be
    able to find someone who can help.

    I have no real experience with 'nix, but do have a shared (Red Hat I think?)
    hosting account. I am trying to set up a promailrc file to direct incoming
    mail to a script. This works fine when I don't use conditionals:

    :0
    | /usr/bin/php /home/myaccount/myscript

    However, all conditionals seem to fail....

    :0
    * Subject.*urgent
    | /usr/bin/php /home/myaccount/myscript

    I have tried so many conditional statements that I do not think it is just
    me getting the syntax wrong... for example, I have tried, as some tutorials
    suggest, having the colon in the above, etc.:

    * Subject:.*urgent

    If anyone could suggest any pearls that would help, I would greatly
    appreciate it.

    Many Thanks,

    Mat.


    mat Guest

  2. #2

    Default Re: Procmail Problem

    mat <yubhuntleyremovebooyahoo.co.uk> wrote:
    > However, all conditionals seem to fail....
    > :0
    > * Subject.*urgent
    > | /usr/bin/php /home/myaccount/myscript
    Try adding

    LOGFILE=somelogfile
    VERBOSE=YES

    at the beginning of the .procmailrc and see what's going on.
    Warning: the "verbose" can become reaaaally verbose...

    Davide
    Davide Bianchi Guest

  3. #3

    Default Re: Procmail Problem

    Davide Bianchi <davideyeahsureonlyforfun.net> wrote:
    > mat <yubhuntleyremovebooyahoo.co.uk> wrote:
    > > However, all conditionals seem to fail....
    > > :0
    > > * Subject.*urgent
    > > | /usr/bin/php /home/myaccount/myscript
    > Try adding
    > LOGFILE=somelogfile
    > VERBOSE=YES
    Isn't it:
    VERBOSE=on

    I'd add in addition:
    LOGABSTRACT=all

    --
    Michael Heiming

    Remove +SIGNS and www. if you expect an answer, sorry for
    inconvenience, but I get tons of SPAM
    Michael Heiming Guest

  4. #4

    Default Re: Procmail Problem

    Michael Heiming <michael+USENETwww.heiming.de> wrote:
    >> LOGFILE=somelogfile
    >> VERBOSE=YES
    > Isn't it:
    > VERBOSE=on
    Hummm... I've used VERBOSE=YES and it worked, but probably is because
    I've a quite mangled version of procmail.

    Davide
    Davide Bianchi Guest

  5. #5

    Default Re: Procmail Problem

    Hi Davide and Michael,

    Thank you for your advice. I did as you said, and now have the following
    procmailrc file:

    LOGFILE=/home/account/maillogs/mail.txt
    VERBOSE=on
    LOGABSTRACT=all

    :0
    ^From.*mat*
    ^Subject:.*mail2
    |/usr/bin/php /home/account/incoming/mail.php

    This is not supposed to, but does, write two files before failing. One is
    the LOGFILE mail.txt file and the other is one called ^From.*mat*.
    Obviously, it thinks I want the mail written to the "file" ^From etc., but
    why? Why doesn't it see that as a conditional. This has also raised another
    problem, in as much as both of these files (i.e. the LOGFILE as well) are in
    accessible to me via ftp or the servers control panel... I can see them but
    not touch them. Tech support suggested this was because Procmail would have
    written it with "mail" as a user, and that this therefore blocked me out...

    If I can appeal to you guys again for help on this one, I am more than at a
    loss to know what to do from here.

    Thanks Again,

    Mat



    "mat" <yubhuntleyremovebooyahoo.co.uk> wrote in message
    news:bntrj1$e7m$1news8.svr.pol.co.uk...
    > Hi all,
    >
    > I am sorry if this is not the right forum for this sort of question, it
    > seemed the best match from the forums I had on offer. Hopefully I will be
    > able to find someone who can help.
    >
    > I have no real experience with 'nix, but do have a shared (Red Hat I
    think?)
    > hosting account. I am trying to set up a promailrc file to direct incoming
    > mail to a script. This works fine when I don't use conditionals:
    >
    > :0
    > | /usr/bin/php /home/myaccount/myscript
    >
    > However, all conditionals seem to fail....
    >
    > :0
    > * Subject.*urgent
    > | /usr/bin/php /home/myaccount/myscript
    >
    > I have tried so many conditional statements that I do not think it is just
    > me getting the syntax wrong... for example, I have tried, as some
    tutorials
    > suggest, having the colon in the above, etc.:
    >
    > * Subject:.*urgent
    >
    > If anyone could suggest any pearls that would help, I would greatly
    > appreciate it.
    >
    > Many Thanks,
    >
    > Mat.
    >
    >

    mat Guest

  6. #6

    Default Re: Procmail Problem

    mat <yubhuntleyremovebooyahoo.co.uk> wrote:
    > the LOGFILE mail.txt file and the other is one called ^From.*mat*.
    You forgot to put a * at the beginning of the line where the rule
    is.

    Davide
    Davide Bianchi Guest

  7. #7

    Default Re: Procmail Problem

    Thanks Davide! (feels a little foolish now!)

    Mat

    "Davide Bianchi" <davideyeahsureonlyforfun.net> wrote in message
    news:bo0tn8$16gg68$3ID-18487.news.uni-berlin.de...
    > mat <yubhuntleyremovebooyahoo.co.uk> wrote:
    > > the LOGFILE mail.txt file and the other is one called ^From.*mat*.
    >
    > You forgot to put a * at the beginning of the line where the rule
    > is.
    >
    > Davide

    mat Guest

  8. #8

    Default Re: Procmail Problem

    In article <bo0tn8$16gg68$3ID-18487.news.uni-berlin.de>,
    Davide Bianchi <davideyeahsureonlyforfun.net> wrote:
    >mat <yubhuntleyremovebooyahoo.co.uk> wrote:
    >> the LOGFILE mail.txt file and the other is one called ^From.*mat*.
    >
    >You forgot to put a * at the beginning of the line where the rule
    >is.
    Note that the syntax of procmailrc is *really*:

    :N
    rule1
    ....
    ruleN

    where N is the number of rule lines. It is just that sometime later, they
    decided to allow * to be sort of an "escape character" that would make
    something a rule, regardless of the count. So, then the convention became
    to put the count as 0 and always use the * feature. I suppose this is
    a little easier for the mentally-challenged to wrap their brains around, but
    it always struck me as cooky. Thus, I continue to use the original syntax,
    which makes more sense to me.

    So, in your case, you can do:

    :2
    ^Subject.*...
    ^From.*...


    Kenny McCormack Guest

  9. #9

    Default Re: Procmail Problem

    Kenny McCormack <gazelleyin.interaccess.com> wrote:
    > In article <bo0tn8$16gg68$3ID-18487.news.uni-berlin.de>,
    > Davide Bianchi <davideyeahsureonlyforfun.net> wrote:
    >>mat <yubhuntleyremovebooyahoo.co.uk> wrote:
    >>> the LOGFILE mail.txt file and the other is one called ^From.*mat*.
    >>You forgot to put a * at the beginning of the line where the rule
    >>is.
    > Note that the syntax of procmailrc is *really*:
    > :N
    > rule1
    > ...
    > ruleN
    > where N is the number of rule lines. It is just that sometime later, they
    > decided to allow * to be sort of an "escape character" that would make
    > something a rule, regardless of the count. So, then the convention became
    > to put the count as 0 and always use the * feature. I suppose this is
    > a little easier for the mentally-challenged to wrap their brains around, but
    > it always struck me as cooky. Thus, I continue to use the original syntax,
    > which makes more sense to me.
    I would say that the original syntax was a "little y" (as it were)
    and tell my students to treat the :0 as a block delimiter. I do teach them
    the historical meaning of the digit. I honestly didn't know that the old
    form was still supported :)
    > So, in your case, you can do:
    > :2
    > ^Subject.*...
    > ^From.*...


    --
    Jim Dennis,
    Starshine: Signed, Sealed, Delivered

    James T. Dennis Guest

Similar Threads

  1. ProcMail with Perl and MailAudit
    By Pablo Fischer in forum PERL Beginners
    Replies: 0
    Last Post: August 31st, 01:21 AM
  2. Perl script vs. fetchmail & procmail
    By James Willmore in forum PERL Beginners
    Replies: 2
    Last Post: August 21st, 09:51 AM
  3. Procmail partially working
    By J. Zidar in forum Debian
    Replies: 5
    Last Post: August 7th, 02:50 PM
  4. Spamassassin and procmail
    By Antony Gelberg in forum Debian
    Replies: 8
    Last Post: August 4th, 09:40 PM
  5. procmail and vacation
    By Per Hedeland in forum Sun Solaris
    Replies: 1
    Last Post: July 1st, 10:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139