procmail
[Top] [All Lists]

Re: forwarding with properly delivered bounces

2006-01-16 22:01:35

Here is an updated recipe.
Comments are appreciated!
Alex


####### Forwarding recipe begins #######

# Triggered by absence/presence of FWD_PROCFILE
# Local copy delivery is triggered by 1/0 inside FWD_PROCFILE
FWD_PROCFILE=$HOME/.forward.procmail

# Email to send bounces when no origin is found
# (be careful with usign local account here, otherwise loop may occur
#   if user BOUNCES installs forwarding for himself and it bounce occurs)
BOUNCES=root

# Host on behalf of which the bounce is sent
BOUNCEHOST=bounce.domain.tld

# File containing addresses to forward to, one per line
FWD_ADDRFILE=$HOME/.forward.fwd

DOFWD_LOC=`cat $FWD_PROCFILE`


:0
* ! DOFWD_LOC ?? ^^^^
{

  FWDADDRS=`/bin/awk '{ printf "%s,",$0 } END { print }' $FWD_ADDRFILE`

  :0
  * ! FWDADDRS ?? ^^^^
  {

    :0
    * ^X-Loop-SiteID: *\/.*
    { FORWARDER = ${MATCH} }

    :0 fw
    *$ ! LOGNAME ?? ^^$FORWARDER^^
    | /usr/bin/formail -i"X-Loop-SiteID: $LOGNAME" \
                       -R Return-Path X-Loop-SiteID-Return-Path
    :0 Acw
    * !^FROM_DAEMON
    ! $FWDADDRS

    :0
    * ^FROM_DAEMON
    {

      :0 B
      * ^X-Loop-SiteID-Return-Path: *\/.*
      { ORIGSENDER = ${MATCH} }
      :0 Afw
      | /usr/bin/formail -i"To: $ORIGSENDER" \
        -i"From: MAILER-DAEMON(_at_)$BOUNCEHOST (Mail Delivery System)"
      :0 A
      * ! ORIGSENDER ?? ^^^^
      | $SENDMAIL $SENDMAILFLAGS \
        -f MAILER-DAEMON(_at_)$BOUNCEHOST $ORIGSENDER

      :0 fw
      | /usr/bin/formail -i"Subject: cannot deliver bounced for $LOGNAME @
SiteID"
      :0
      ! $BOUNCES

    }

    :0
    * DOFWD_LOC ?? ^^0^^
    /dev/null

  }
}

####### Forwarding recipe ends #######




On 09 Jan 2006, at 13:50 , Alexey Koptsevich wrote:
I am trying to design a forwarding recipe for procmail, which,
contrary to
one given at http://www.openspf.org/faq.html#forwarding, would handle
bounces properly, i.e. return them to original sender. This one
works for
me, but before putting it into production, I would appreciate an
opinion
of seasoned procmail users.

You should never bounce messages taht have been accepted by your
mailserver as delivered.

Never.

Thanks for the reply! I would feel very much obliged if you could
clarify reasoning behind this statement or give a reference where
it is explained. My ultimate goal is to avoid losing forwarded
mail because of SPF. I am using postfix, and SRS is not supported
by it. Are there other solutions?

In case of traditional forwarding, the message can be bounced by
the final destination although it was earlier accepted by the
forwarder. So the problem with my setup is that the message is
bounced by the same host which accepted it earlier? Would sending
the bounce message from the same server but using different
hostname (DNS alias) make my setup comply with that "Never"?

Thanks,
Alex



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail




____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>