On Mon, 2006-03-13 at 18:46, [EMAIL PROTECTED] wrote:
> On Mon, 2006-03-13 at 15:28, [EMAIL PROTECTED] wrote:
> > However, I'm having some problems getting the 'recipient' variable to
> > set as desired.
> > 
> > Basically, when the confirmation_request email is sent, I'd like the
> > "From" address to be set to the "Alias" in which the original incoming
> > message was sent to.  So far, all confirmation_requests have been coming
> > from the REAL email/user address.
> 
> I found some samples out
> there, and kind of hacked them into what I needed.  Hope its helpful to
> someone.

Ok, apparently changing the RECIPIENT to anything other than he REAL
user is a bad idea.  I could not get TMDA to function properly with any
setting other than the real [EMAIL PROTECTED]  So, I've opted for an
alternate solution of assigning a custom variable, and importing that
custom variable into the TMDA script.

And I've even tested my work this time.  ;)

This solution assumes that the DELIMITER is a plus (+) sign.

If there's any procmail guru's out there, I'd appreciate feedback on
making the code shorter.  It's a bit unwieldy.

Rich

---  Additions required for .procmailrc ---
:0 W
*$ H ?? 1^1 ^Received:
{
RECEIVEDHEAD=`formail -cX"Received:" |\
cat -n |\
sed -e 's/\t/ /g' -e 's/[ ]\+/ /g' -e 's/^ //' -e 's/^[0-9]\+/&:/' \
`
}

0
* RECEIVEDHEAD ?? ^1: Received: .*for <\/[EMAIL PROTECTED]
{
  FOUNDRECIP=${MATCH}
  :0
  * ! FOUNDRECIP ?? \+
  {
    ALIAS_RECIPIENT=${MATCH}
  }

  :0
  * FOUNDRECIP ?? \+
  {
    :0
    * RECEIVEDHEAD ?? ^1: Received: .*for <\/[a-zA-Z0-9.]+
    {
      BEGINRECIP=${MATCH}
      :0
      * FOUNDRECIP ?? @\/[a-zA-Z0-9.]+
      {
         [EMAIL PROTECTED]
      }
    }
  }
}

:0
* ! RECEIVEDHEAD ?? ^1: Received: .*for <\/[EMAIL PROTECTED]
{
  ALIAS_RECIPIENT="[EMAIL PROTECTED]"
}
--- end of .procmailrc additions ---

Must add 2 "alias_recipient" lines to tmda-rfilter as seen below.

-- tmda-rfilter --
# SENDER is the envelope sender address.
alias_recipient = os.environ.get('ALIAS_RECIPIENT')
envelope_sender = os.environ.get('SENDER')

  # in def bouncegen() function
  alias_recipient   = globals().get('alias_recipient')
-- end of tmda-rfilter --

Use "alias_recipient" in the template file as seen blow.

-- confirm_request.txt --
From.US-ASCII: "%(FULLNAME)s" <%(alias_recipient)s>
-- end of confirm_request.txt --



_____________________________________________
tmda-users mailing list (tmda-users@tmda.net)
http://tmda.net/lists/listinfo/tmda-users

Reply via email to