Loading ...
Sorry, an error occurred while loading the content.
 

Re: Restrictive Email Format forwarding to Script

Expand Messages
  • /dev/rob0
    ... I don t have time right now to go into the entire post, but I will quickly jump on this, with a wink and a nod to Mr. Zawinski: You thought you could
    Message 1 of 3 , Feb 28, 2012
      On Tue, Feb 28, 2012 at 06:51:16PM +0100, Tugdual de Lassat (ML) wrote:
      > I have a transport regex : transportregex
      >
      > /bounce.*@*/ bounceh:
      > /return.*@*/ bouncer:

      I don't have time right now to go into the entire post, but I will
      quickly jump on this, with a wink and a nod to Mr. Zawinski: "You
      thought you could solve your problem with regular expressions. Now
      you have two problems."

      LEARN regular expressions if you plan to use them. KNOW what those
      metacharacters mean. KNOW how and when and why you need to anchor
      expressions.

      > Called in main.cf :
      > transport_maps = regexp:/etc/postfix/transportregex

      Test those expressions against these addresses:
      postmap -q info@... regexp:/etc/postfix/transportregex
      postmap -q taxreturns@... regexp:/etc/postfix/transportregex
      postmap -q bouncer@... regexp:/etc/postfix/transportregex
      postmap -q info@... regexp:/etc/postfix/transportregex

      Are these addresses supposed to be handled by your pipes? No? Oops.

      > And corresponding pipes in master.cf
      >
      > bounceh unix - n n - - pipe
      >
      > flags=DRhu user=www-data argv=/usr/bin/php
      > /home/samba/test/get_bounces.php
      >
      > bouncer unix - n n - - pipe
      >
      > flags=DRhu user=www-data argv=/usr/bin/php /home/samba/test/get_return.php
      --
      http://rob0.nodns4.us/ -- system administration and consulting
      Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
    • Noel Jones
      ... (plain text only please) Wildcard domain transports are probably a mistake, quite likely to come back and bite you later. Anyway, your regexp is wrong. ...
      Message 2 of 3 , Feb 28, 2012
        On 2/28/2012 11:51 AM, Tugdual de Lassat (ML) wrote:
        > Hello the list..
        >
        >
        >
        > I’m asking your support for a problem we are facing using Postfix
        > server configuration…
        >
        >
        >
        > We are trying to setup an internal CRM Solution, that has to manage
        > mail returns depending type of message…
        >
        > We have actually 2 sorts of email types :
        >
        > Bounce.xxxxx-xxxx-xxxx@...
        > <mailto:Bounce.xxxxx-xxxx-xxxx@...> that can be also
        > @... (we have several communication methods and domains)
        >
        > Return.xxxxx-xxxx-xxxx@...
        > <mailto:Return.xxxxx-xxxx-xxxx@...> (same as above).
        >
        >
        >
        > Both addresses must pipe to a script in order to
        >
        > - cope bounces and remove know clients from our CRM database
        >
        > - Send mail returns to the right person linked to the CRM
        > Database (and moreover undertake CRM actions)
        >
        >
        >
        > I have a transport regex : transportregex
        >
        >
        >
        > /bounce.*@*/ <mailto:/bounce.*@*/> bounceh:
        >
        > /return.*@*/ <mailto:/return.*@*/> bouncer:

        (plain text only please)

        Wildcard domain transports are probably a mistake, quite likely to
        come back and bite you later.

        Anyway, your regexp is wrong.


        >
        >
        >
        > Called in main.cf :
        >
        > transport_maps = regexp:/etc/postfix/transportregex
        >
        >
        >
        > And corresponding pipes in master.cf
        >
        > bounceh unix - n n - - pipe
        >
        > flags=DRhu user=www-data argv=/usr/bin/php
        > /home/samba/test/get_bounces.php
        >
        > bouncer unix - n n - - pipe
        >
        > flags=DRhu user=www-data argv=/usr/bin/php
        > /home/samba/test/get_return.php
        >
        >
        >
        > Yet when I send a mail to the transport (SMTP mails outside the
        > server, not locally which weirdly seems to work), I always get the
        > following return :
        >
        > 550 5.1.1 <bounce.xxxxx-xxxx-xxxx@...
        > <mailto:bounce.xxxxx-xxxx-xxxx@...>>: Recipient address
        > rejected: User unknown in local recipient table

        So the user is unknown for a domain listed in $mydestination.
        http://www.postfix.org/ADDRESS_CLASS_README.html
        http://www.postfix.org/LOCAL_RECIPIENT_README.html

        You can use a regexp alias_maps something like
        /^bounce\./ bounce@localhost
        /^return\./ return@localhost

        in which case your transport map becomes simpler non-regexp

        bounce@localhost bounceh:
        return@localhost bouncer:




        -- Noel Jones
      Your message has been successfully submitted and would be delivered to recipients shortly.