procmail
[Top] [All Lists]

Re: vpopmail bouncing problems

2002-12-04 22:35:29
Is not working i dot get bounced message.


this is my actual situation, i am using vpopmail with some virtual domains
and i use procmail so users that have webmail can filter unwanted email,
for that i am using the sqblock.rc file that is a set of rules for the
squirrelmail webmail and they work fine.

on my virtual host i have

~vpopmail/domains/unixmexico.org/.qmail-default

and in that file i have:

|preline /usr/local/bin/procmail -p -m /etc/procmailrc

now, on /etc/procmailrc i have:

INCLUDERC=/usr/local/squirrelmail/plugins/block_sender/sqblock.rc
:0w
|/usr/local/vpopmail/bin/vdelivermail '' bounce-no-mailbox


the sqblock.rc has :

--
# Location of the SquirrelMail user data files
SQDATA=/usr/local/squirrelmail/data

# Location of the user's SM Trash file ($HOME represents the user's home dir)
SQTRASH=/dev/null

# Full, absolute path of the test utility on the system
TESTPATH=/bin/test

# Full, absolute path of the formail utility on the system
FORMAILPATH=/usr/local/bin/formail

# Full, absolute path of the grep utility on the system
GREPPATH=/usr/bin/grep

# Full, absolute path of the sed utility on the system
SEDPATH=/usr/bin/sed
VERBOSE=yes
LOGABSTRACT=yes
LOGFILE=/var/log/procmail.log
LOG="
"
############################
:0
* ? $TESTPATH -f $SQDATA/$BLOCKLIST
{
   # Get the sender's email address
   :0h
   SENDER=|$FORMAILPATH -IReply-To: -rtzxTo:

   # Grab the domain from the sender
   DOMAIN=\*(_at_)`echo $SENDER|sed s/^.*@//`

   :0
   * 1^0 ? $GREPPATH $SENDER $SQDATA/$BLOCKLIST
   * 1^0 ? $GREPPATH $DOMAIN $SQDATA/$BLOCKLIST
   {
      DROPPRIVS=yes
      :0
      $SQTRASH
   }
}

--

now this works fine users can block unwanted email, the filter works Ok.
the problem is that if some one send an email to a user that is not on the
virtualhost, he dont get bounced back

for example if i email to no_user(_at_)unixmexico(_dot_)org i wont get a 
respond from
MAILER-DAEMOND telling me that the user no_user don't exists


this is the output of my log, when sending an email to 
no_user(_at_)unixmexico(_dot_)org

---
procmail: Assigning "LOG=
"

procmail: Executing
"/bin/test,-f,/usr/local/squirrelmail/data/no_user(_at_)unixmexico(_dot_)org(_dot_)block"
procmail: Non-zero exitcode (1) from "/bin/test"
procmail: No match on "/bin/test -f
/usr/local/squirrelmail/data/no_user(_at_)unixmexico(_dot_)org(_dot_)block"
procmail: Executing "/usr/local/vpopmail/bin/vdelivermail,,bounce-no-mailbox"
procmail: Program failure (100) of "/usr/local/vpopmail/bin/vdelivermail"
procmail: Assigning "LASTFOLDER=/usr/local/vpopmail/bin/vdelivermail 
bounce-no-mailbox"From nbari(_at_)unixmexico(_dot_)org Thu Dec 05 05:06:14 2002
 Subject: test
  Folder: **Bounced**
---


now  if i put EXITCODE=100 on the /etc/procmailrc at the end of the rules:

INCLUDERC=/usr/local/squirrelmail/plugins/block_sender/sqblock.rc
:0w
|/usr/local/vpopmail/bin/vdelivermail '' bounce-no-mailbox
EXITCODE=100

bounce works but the bounce messages has something like this:

From: MAILER-DAEMON(_at_)unixmexico(_dot_)org

Hi. This is the qmail-send program at ns3.unixmexico.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<no_user(_at_)unixmexico(_dot_)org>:
procmail: [74056] Wed Dec  4 23:08:47 2002
procmail: Assigning "LOGABSTRACT=yes"
procmail: Assigning "LOGFILE=/var/log/procmail.log"
procmail: Opening "/var/log/procmail.log"


here instead of getting a message like saying NO MAILBOX FOUND. i get

procmail: [74056] Wed Dec  4 23:08:47 2002
procmail: Assigning "LOGABSTRACT=yes"
procmail: Assigning "LOGFILE=/var/log/procmail.log"
procmail: Opening "/var/log/procmail.log"


now, my questions are

how can i chage this bounce message, or do i have an error on my rules ?


should i use .qmail or .qmail-default under my vhost

should i use:
|preline /usr/local/bin/procmail -p -m /etc/procmailrc
or
|preline /usr/bin/procmail

how can i call or make the  line |/var/qmail/bin/bouncesaying 'Sorry, go
away' to work

what should i modify on my config o what do i am doing wrong ?
why if i just put an EXITCODE=100 bounce start working but sending
procmail lines like logs of procmail instead of a custom message.


regards



BTW thanks for your fast answer and your help.

An example:

    In ~/.qmail:

        |preline /usr/bin/procmail
        |/var/qmail/bin/bouncesaying 'Sorry, go away'

    And, as a simple example, in ~/.procmailrc, (or
    /etc/procmailrc):

      DEFAULT="nbari"
      LOGFILE="${HOME}/PROCMAIL.LOG"
      VERBOSE="on"
      LOGABSTRACT="all"
      #
      EXITCODE=99
      #
      :0
      * ^from:[ ]+(_dot_)*conover(_at_)rahul\(_dot_)net
      conover
      #
      :0
        * ^sender:[
]+(.*[^-0-9a-z._+=?*])*procmail-admin(_at_)lists\(_dot_)rwth-aachen\(_dot_)de
      procmail
      #
      :0
      * ^from:[ ]+(_dot_)someone(_at_)you-dontlike\(_dot_)com
      {
          #
          # Mail from someone(_at_)you-dontlike(_dot_)com gets bounced with
          # the message "Sorry, go away" to the envelope from
          # address.
          #
          EXITCODE=0
          #
          :0
          /dev/null
      }
      #
      # Any remaining e-mail will be filed in the nbari file.
      #

Note that you can not test the script as:

    procmail ~/.procmailrc < testemail

where testemail is a test email message file. You have to:

    qmail-inject -fsender nbari < testemail

where sender is the same address as in the 'From conover(_at_)rahul(_dot_)net 
Wed
Dec 12 ...'  first line header.

      John

John Conover writes:

The EXITCODE=99 goes at the top of the file, before any delivery-its
the default procmail exit back to ~/.qmail file, and stops qmail-local
from executing the rest of the ~/.qmail file, (i.e., bouncesaying.) To
qmail-local, it means the message was delivered by piping it to
preline procmail, quit.

Everything exits with EXITCODE=99, unless there is an exception.

Use EXITCODE=0 just prior to any exception; all messages have to be
handled in the procmail script, so its something like:

    EXITCODE=0
    :0
    /dev/null

which will handle the message by dumping it in /dev/null, in procmail,
and tells qmail-local that the message was not delivered, continue
executing the lines in ~/.qmail, (i.e., bouncesaying pipe will then
bounce the message.)

     John

BTW, you should use ~/.qmail, unless you are specifically using the
dash extensions. The reason is that if I send a message to
nbari-asdf(_at_)unixmexico(_dot_)com, it will be handled by ~/.qmail-default,
even though nbari-asdf doesn't exist. If you use ~/.qmail, then it
won't get that far; qmail will bounce the message, immediately,
because there are no dash extensions handled by the account nbari.

If you do use extensions, identify them specifically; ~/qmail-john,
~/qmail-fred, etc.

nbari(_at_)unixmexico(_dot_)com writes:
ok on my .qmail-default i have

|preline /usr/local/bin/procmail -p -m /etc/procmailrc
|/var/qmail/bin/bouncesaying 'Whatever you want to say here'

now on my /etc/procmialrc

i have

INCLUDERC=/usr/local/squirrelmail/plugins/block_sender/sqblock.rc
:0w
|/usr/local/vpopmail/bin/vdelivermail '' bounce-no-mailbox

and here i should put the exitcode=99 ?

sorry but i dont undertand the part of the .procmailrc file
can you showme an example

thanks.



With qmail, you might try, in ~/.qmail:

    |preline /usr/bin/procmail
    |/var/qmail/bin/bouncesaying 'Whatever you want to say here'

and then in ~/.procmailrc

    #
    # default exitcode=99 if the procmailrc script delivers the #
message; exitcode=0, (yes, that is correct; 99 is the normal #
exit, 0 is the exception handling,)
    #
    EXITCODE=99
    .
    .
    .
    :0
    * this
    * and
    * that
    this-and-that file
    .
    .
    .
    :0
    * an
    * exception
    {
        #
        # exception handling ...
 #
 EXITCODE=0
 /dev/null
    }

where the last conditional will bounce the message back to the
sender's envelope address, with the error message "Whatever you
want to say here".

 John

BTW, the reason you want to do it this way is that qmail-local,
(the qmail delivery agent,) has a lot of very useful variables set
in the environment, (such as all the envelope variables-which may
not be the same as what's in the message header-which can be
changed/manipulated,) and qmail-local invokes ~/.qmail, but not
procmail, (preline does that.)

At any rate, as per man qmail-local, the recommended way of doing
it is to run bouncesaying(1) out of ~/.qmail.

Also, see man qmail-control for the exit codes.

nbari(_at_)unixmexico(_dot_)com writes:
when puting
 |bouncesaying "whatever you want here."

Instead of putting EXITCODE=100

i get this :

procmail: Skipped "|/var/qmail/bin/bouncesaying "This address no
longer accepts mail." "

--

John Conover, conover(_at_)rahul(_dot_)net, http://www.rahul.net/~conover




_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail