Another procmail configuration

Discussion in 'Perl Misc' started by Pet Farrari, Jan 24, 2007.

  1. Pet Farrari

    Pet Farrari Guest

    Hi,

    I am having problem with setting up procmail to work with a C program I
    wrote. The C program is to determine whether the domain part of the
    incoming email is a forwarded email, if it is, procmail will not filter
    its spam into local cyrus mail box. I m not really sure the syntax I use
    in this conf file is correct or not.

    Your suggestion is much appreciated.

    Here is the promailrc script:

    SHELL=/bin/sh
    DROPPRIVS=yes
    LINEBUF=32768
    SENDMAILFLAGS="-oi"
    LOGFILE="/var/log/spamkill/spamkill.log"
    SPAMC="/usr/local/bin/spamc"

    FROM="<$1>"
    TO=$2
    SHIFT=1


    :0f
    |$SPAMC -f -U /var/run/spamd.sock

    :0
    * ^X-Spam-Level: \*\*\*\*\*
    {
    USER=`echo $TO | cut -d "@" -f1`
    DOMAIN=`echo $TO | cut -d "@" -f2`

    # Debug statement. Comment out these Debug log lines later.
    #LOG="[$$]$_: Debug: TO=$TO${NL}\n"
    #LOG="[$$]$_: Debug: USER=$USER${NL}\n"
    #LOG="[$$]$_: Debug: DOMAIN=$DOMAIN${NL}\n"

    # Execute CYRUSUSER's personal rules
    #INCLUDERC=/var/imap/procmail/user/procmail.$CYRUSUSER

    # All the mail that falls through to this point will be delivered into
    the user's Spam,
    # INBOX folder or forwarded to external smtp server.
    :0 wi
    {

    IS_FWD=`/usr/local/sbin/alias2user $DOMAIN`
    LOG="[$$]$_: Debug: IS_FWD=$IS_FWD${NL}\n"
    # theres an error when determng whether thiss a forwarded domain
    * !IS_FWD ?? "-1"
    {
    | /usr/local/cyrus/bin/deliver -r
    admin/Inbox
    # not a forwarded domain
    :0
    * IS_FWD ?? "0"
    {
    | /usr/local/cyrus/bin/deliver -r
    $USER@$DOMAIN $USER/Spam
    }

    # Else Delivery failed. So we need to handle the error
    condition.
    :0 e
    {
    # Get the return code from the last program that ran
    and report it in the logfile.
    ERRORCODE=$?
    LOG="[$$]$_: XX-Failed delivery ERRORCODE=${ERRORCODE}
    ${NL}"
    }
    }
    }
    }

    :0
    ! -f $FROM "$@"

    Its error log from procmail in regarding trigger this receipts is:

    procmail: Extraneous ignore-write-error flag ignored
    procmail: Skipped "* !IS_FWD ?? "-1""
    procmail: Skipped "{"
    procmail: Skipped "| /usr/local/cyrus/bin/deliver -r
    admin/Inbox"
    procmail: Skipped "| /usr/local/cyrus/bin/deliver -r $USER@$DOMAIN
    $USER/Spam"
    procmail: Closing brace unexpected
    Subject: testing
    Folder: /usr/sbin/sendmail -oi -f <>
    1244

    Thanks
    S
     
    Pet Farrari, Jan 24, 2007
    #1
    1. Advertising

  2. Pet Farrari

    Uri Guttman Guest

    and your perl question is?

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Jan 24, 2007
    #2
    1. Advertising

  3. Pet Farrari

    Pet Farrari Guest

    Uri Guttman wrote:
    > and your perl question is?
    >
    > uri
    >

    I think many perl expert in this forum knows the answer of this question?

    Thanks
    S
     
    Pet Farrari, Jan 24, 2007
    #3
  4. Pet Farrari

    Uri Guttman Guest

    >>>>> "PF" == Pet Farrari <> writes:

    PF> Uri Guttman wrote:
    >> and your perl question is?
    >> uri
    >>

    PF> I think many perl expert in this forum knows the answer of this question?

    but it isn't a perl question. i am a good cook but i won't answer food
    questions here either.

    procmail is not perl.

    Mail::procmail is perl.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Jan 24, 2007
    #4
  5. Pet Farrari

    Dr.Ruud Guest

    Pet Farrari schreef:

    > I am having problem with setting up procmail to work with a C program
    > I wrote.


    I can answer this question on the procmail mailing list.
    See http://www.procmail.org/era/lists.html on how to subscribe.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Jan 25, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    1,856
    Jim Gibson
    Nov 15, 2006
  2. Pet Farrari

    Another procmail configuration

    Pet Farrari, Jan 24, 2007, in forum: Perl
    Replies:
    3
    Views:
    2,136
    Randal L. Schwartz
    Jan 28, 2007
  3. Mislav Kasner

    Procmail to ruby

    Mislav Kasner, Nov 5, 2007, in forum: Ruby
    Replies:
    3
    Views:
    206
    Jonathan Hudson
    Nov 6, 2007
  4. J Cardella
    Replies:
    3
    Views:
    192
    Johan Vromans
    Sep 28, 2004
  5. Horst Lemminger
    Replies:
    1
    Views:
    447
    Dr Eberhard Lisse
    Dec 20, 2011
Loading...

Share This Page