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

Deliver to sender instead of recipient

Expand Messages
  • Fernando Gozalo
    Hi, How can I deliver the messages to the mailbox of the sender instead of the mailbox of the recipient? Explanation: Developers want to test their
    Message 1 of 5 , Jul 25, 2013
    • 0 Attachment
      Hi,

      How can I deliver the messages to the mailbox of the sender instead of
      the mailbox of the recipient?

      Explanation:
      Developers want to test their applications using a pre-production
      system. Their applications send mail. So I must configure a smtp server
      that receive the messages the same way as our production smtp server
      but... the messages must not leave this mail server and postfix must
      deliver them in the local mailbox of the sender address. So developers
      can validate the correctness of the messages that their applications send.

      Regards,
      Fernando.

      --
      ---------------------------------------------------------------
      Fernando Gozalo Rodrigo - Analista de Sistemas

      Centro de Sistemas Informáticos
      Universidad Nacional de Educación a Distancia

      ---------------------------------------------------------------
      Por favor, no envíe adjuntos de WORD, EXCEL o POWERPOINT
      Vea http://www.gnu.org/philosophy/no-word-attachments.es.html
      ---------------------------------------------------------------
    • Wietse Venema
      ... /etc/postfix/main.cf: smtpd_sender_restrictions = pcre:/etc/postfix/sender_access /etc/postfix/sender_access: /.+/ redirect $1 Documentation:
      Message 2 of 5 , Jul 25, 2013
      • 0 Attachment
        Fernando Gozalo:
        > Hi,
        >
        > How can I deliver the messages to the mailbox of the sender instead of
        > the mailbox of the recipient?

        /etc/postfix/main.cf:
        smtpd_sender_restrictions = pcre:/etc/postfix/sender_access

        /etc/postfix/sender_access:
        /.+/ redirect $1

        Documentation: http://www.postfix.org/access.5.html

        You can also do this with header_checks. I leave that as an exercise
        for the reader.

        Wietse
      • Ralf Hildebrandt
        ... Doesn t this require ()? /(.+)/ redirect $1 or are the () implied if there s only one match group -- [*] sys4 AG http://sys4.de, +49 (89) 30 90 46 64
        Message 3 of 5 , Jul 25, 2013
        • 0 Attachment
          * Wietse Venema <wietse@...>:
          > Fernando Gozalo:
          > > Hi,
          > >
          > > How can I deliver the messages to the mailbox of the sender instead of
          > > the mailbox of the recipient?
          >
          > /etc/postfix/main.cf:
          > smtpd_sender_restrictions = pcre:/etc/postfix/sender_access
          >
          > /etc/postfix/sender_access:
          > /.+/ redirect $1

          Doesn't this require ()?
          /(.+)/ redirect $1

          or are the () implied if there's only one match group

          --
          [*] sys4 AG

          http://sys4.de, +49 (89) 30 90 46 64
          Franziskanerstraße 15, 81669 München

          Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
          Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
          Aufsichtsratsvorsitzender: Florian Kirstein
        • /dev/rob0
          ... I thought the same thing when I saw this, and I referred to the pcre_table(5) manual: Substitution of substrings from the matched expression into the
          Message 4 of 5 , Jul 25, 2013
          • 0 Attachment
            On Thu, Jul 25, 2013 at 08:26:24PM +0200, Ralf Hildebrandt wrote:
            > * Wietse Venema <wietse@...>:
            > > Fernando Gozalo:
            > > > How can I deliver the messages to the mailbox of the sender
            > > > instead of the mailbox of the recipient?
            > >
            > > /etc/postfix/main.cf:
            > > smtpd_sender_restrictions = pcre:/etc/postfix/sender_access
            > >
            > > /etc/postfix/sender_access:
            > > /.+/ redirect $1
            >
            > Doesn't this require ()?
            > /(.+)/ redirect $1

            I thought the same thing when I saw this, and I referred to the
            pcre_table(5) manual:
            Substitution of substrings from the matched expression
            into the result string is possible using the conventional
            perl syntax ($1, $2, etc.); ...
            Basically it says "see the Perl documentation for their syntax."

            I lost interest at that point. :) But I got reinterested with your
            post, and made a simple test:

            $ echo -e '/.+/ redirect $1\n/(.+)/ redirect $1' > pcre
            $ /usr/sbin/postmap -q testing pcre:./pcre
            postmap: warning: pcre map ./pcre, line 1: out of range replacement index "1": skipping this rule
            redirect testing

            > or are the () implied if there's only one match group

            So no, apparently you are right. Or this might vary with different
            PCRE implementations?
            --
            http://rob0.nodns4.us/ -- system administration and consulting
            Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
          • Viktor Dukhovni
            ... Yes, it does. ... No, this behaviour should be the same for all versions of PCRE. -- Viktor.
            Message 5 of 5 , Jul 25, 2013
            • 0 Attachment
              On Thu, Jul 25, 2013 at 03:03:57PM -0500, /dev/rob0 wrote:

              > > Doesn't this require ()?
              > > /(.+)/ redirect $1

              Yes, it does.

              > > or are the () implied if there's only one match group
              >
              > So no, apparently you are right. Or this might vary with different
              > PCRE implementations?

              No, this behaviour should be the same for all versions of PCRE.

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