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

sometimes_bcc?

Expand Messages
  • Marcio Merlone
    Greetings, Could anybody advice me how to achieve a sometimes_bcc, which should work as an always_bcc only when certain criteria is matched, based on subject
    Message 1 of 16 , Feb 6, 2013
      Greetings,

      Could anybody advice me how to achieve a sometimes_bcc, which should work as an always_bcc only when certain criteria is matched, based on subject and/or destination, like a sieve script?

      Regards.

      --
      Marcio Merlone
    • Noel Jones
      ... If you can make the decision based on some combination of envelope information, you can use a policy service such as postfwd to trigger the BCC action.
      Message 2 of 16 , Feb 6, 2013
        On 2/6/2013 10:00 AM, Marcio Merlone wrote:
        > Greetings,
        >
        > Could anybody advice me how to achieve a sometimes_bcc, which should
        > work as an always_bcc only when certain criteria is matched, based
        > on subject and/or destination, like a sieve script?
        >
        > Regards.
        >
        > --
        > Marcio Merlone


        If you can make the decision based on some combination of envelope
        information, you can use a policy service such as postfwd to trigger
        the BCC action.
        http://www.postfix.org/SMTPD_POLICY_README.html
        http://www.postfix.org/access.5.html
        http://postfwd.org/


        If you need to base the decision on mail content such as Subject,
        you'll need some sort of proxy or milter.


        Otherwise, you can do the filtering on your target mailbox; just BCC
        everything and then discard the stuff you don't want to archive.


        -- Noel Jones
      • Marcio Merlone
        ... Nice if it could be done with: - subject_bcc_maps with a pcre map or - header_bcc_maps with a pcre map or - header_checks with a BCC action... So close,
        Message 3 of 16 , Feb 6, 2013
          Em 06-02-2013 14:54, Noel Jones escreveu:
          On 2/6/2013 10:00 AM, Marcio Merlone wrote:
          
          Could anybody advice me how to achieve a sometimes_bcc, which should
          work as an always_bcc only when certain criteria is matched, based
          on subject and/or destination, like a sieve script?
          
          If you need to base the decision on mail content such as Subject,
          you'll need some sort of proxy or milter.
          
          Nice if  it could be done with:
          - subject_bcc_maps with a pcre map or
          - header_bcc_maps with a pcre map or
          - header_checks with a BCC action...

          So close, yet so far...

          Will dig a little more about milter, seems it can be done also with some policy. If someone has some how-i-did to share I will be grateful.

          Thanks and regards.

          --
          Marcio Merlone
        • Noel Jones
          ... header/body checks are too late in the processing to add a recipient, so the BCC action is not available with those features. And header/body checks cannot
          Message 4 of 16 , Feb 6, 2013
            On 2/6/2013 12:53 PM, Marcio Merlone wrote:
            > Em 06-02-2013 14:54, Noel Jones escreveu:
            >> On 2/6/2013 10:00 AM, Marcio Merlone wrote:
            >>> Could anybody advice me how to achieve a sometimes_bcc, which should
            >>> work as an always_bcc only when certain criteria is matched, based
            >>> on subject and/or destination, like a sieve script?
            >> If you need to base the decision on mail content such as Subject,
            >> you'll need some sort of proxy or milter.
            > Nice if it could be done with:
            > - subject_bcc_maps with a pcre map or
            > - header_bcc_maps with a pcre map or
            > - header_checks with a BCC action...
            >


            header/body checks are too late in the processing to add a
            recipient, so the BCC action is not available with those features.
            And header/body checks cannot operate on multiple triggers, so even
            if they could add a recipient it wouldn't fit your criteria of
            {Subject + something else}.



            > So close, yet so far...
            >
            > Will dig a little more about milter, seems it can be done also with
            > some policy.

            No, a postfix policy service does not have access to the email
            content, so it can't see the Subject.

            Your only hope of doing this inside postfix is a milter or a proxy,
            and I'm not sure about a milter.

            Probably your best option is to BCC everything and use a sieve
            script on the recipient mailbox to throw out what you don't want.


            -- Noel Jones


            > If someone has some how-i-did to share I will be grateful.
            >
            > Thanks and regards.
            >
            > --
            > Marcio Merlone
          • Robert Schetterer
            ... Hi Noel, i speculated, if normally there are only pure virtual users, this way might work using a local users maildir as sender bcc target over local
            Message 5 of 16 , Feb 6, 2013
              Am 06.02.2013 20:25, schrieb Noel Jones:
              > On 2/6/2013 12:53 PM, Marcio Merlone wrote:
              >> Em 06-02-2013 14:54, Noel Jones escreveu:
              >>> On 2/6/2013 10:00 AM, Marcio Merlone wrote:
              >>>> Could anybody advice me how to achieve a sometimes_bcc, which should
              >>>> work as an always_bcc only when certain criteria is matched, based
              >>>> on subject and/or destination, like a sieve script?
              >>> If you need to base the decision on mail content such as Subject,
              >>> you'll need some sort of proxy or milter.
              >> Nice if it could be done with:
              >> - subject_bcc_maps with a pcre map or
              >> - header_bcc_maps with a pcre map or
              >> - header_checks with a BCC action...
              >>
              >
              >
              > header/body checks are too late in the processing to add a
              > recipient, so the BCC action is not available with those features.
              > And header/body checks cannot operate on multiple triggers, so even
              > if they could add a recipient it wouldn't fit your criteria of
              > {Subject + something else}.
              >
              >
              >
              >> So close, yet so far...
              >>
              >> Will dig a little more about milter, seems it can be done also with
              >> some policy.
              >
              > No, a postfix policy service does not have access to the email
              > content, so it can't see the Subject.
              >
              > Your only hope of doing this inside postfix is a milter or a proxy,
              > and I'm not sure about a milter.
              >
              > Probably your best option is to BCC everything and use a sieve
              > script on the recipient mailbox to throw out what you don't want.
              >
              >
              > -- Noel Jones
              >
              >
              >> If someone has some how-i-did to share I will be grateful.
              >>
              >> Thanks and regards.
              >>
              >> --
              >> Marcio Merlone
              >

              Hi Noel, i speculated, if normally there are only pure virtual users,
              this way might work

              using a local users maildir as sender bcc target
              over local transport, then forward procmail , filter subject ( rest
              /dev/null ), add some additional header, invoke dovecot deliver back to
              orginal sender via
              ( global ) sieve rule filtering additional header at orginal sender in
              i.e subfolder sent/date etc

              thats not sometimes bcc, but may goal the problem ( cross posted at
              dovecot list )

              Best Regards
              MfG Robert Schetterer

              --
              [*] 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: Joerg Heidrich
            • Marcio Merlone
              ... Greetings, I think I m best rephrasing my previous question and better explain my problem on a higher level without trying to guess a solution. I use
              Message 6 of 16 , Feb 7, 2013
                Em 06-02-2013 14:00, Marcio Merlone escreveu:
                Could anybody advice me how to achieve a sometimes_bcc, which should work as an always_bcc only when certain criteria is matched, based on subject and/or destination, like a sieve script?

                Greetings,

                I think I'm best rephrasing my previous question and better explain my problem on a higher level without trying to guess a solution.

                I use postfix 2.7 with dovecot 1.2.9, PAM system users from LDAP. We have a team of engineers working on a project which must have an archive of all inbound *and* outbound mails regarding such project. For ISO9000 compliance those mails will be identified by its subject matching the regexp /os\s?1234/. Those engineers are also working on other projects, so *_bcc_maps are not the way to go, that would catch other unwanted mails.

                I have created a mail account solely for such purpose, like os.1234@..., which will hold such archiving. They could simply CC such account and all done, but it would not be error/mistake-proof and I don't want to ask my customer to also CC such account or use plus addressing, it must be transparent, based on subject.

                My first try was create a system wide sieve script for dovecot's deliver, but it was not OK because:
                - When multiple internal rcpts, I get multiple copies to os.1234@....
                - When no internal rcpts, I get no copy.

                So, to work on incoming and outgoing mails regardless of rcpts it has to be implemented on postifx. Can someone advice me on how can I solve this?

                Thanks in advance, best regards.

                --
                Marcio Merlone
              • Noel Jones
                ... Regardless of how you state the problem, it should already be clear that postfix does not have native capability to do selective BCC based on the subject.
                Message 7 of 16 , Feb 7, 2013
                  On 2/7/2013 6:14 AM, Marcio Merlone wrote:
                  > it must be transparent, based on subject.
                  >
                  > So, to work on incoming and outgoing mails regardless of rcpts it
                  > has to be implemented on postifx. Can someone advice me on how can I
                  > solve this?

                  Regardless of how you state the problem, it should already be clear
                  that postfix does not have native capability to do selective BCC
                  based on the subject. Adding such a feature to the postfix core
                  would require non-trivial redesign and won't happen anytime soon.

                  You might be able to find a milter that can do this; I haven't
                  looked. You might be able to modify an existing proxy, such as
                  amavisd-new, to do this; that will take some work and an unknown
                  amount of time.

                  Your only sure bet is to have postfix BCC everything and use a sieve
                  script after delivery to discard the unwanted messages.

                  [thinking out loud -- amavisd-new has some archiving features
                  built-in. Maybe it can be convinced to trigger on the Subject.
                  Probably worth looking into.]



                  -- Noel Jones
                • Marcio Merlone
                  ... Yes, it was already. ... There is milter-bcc, commercial license. Found one and another for archiving purposes, badly documented and apparently not active
                  Message 8 of 16 , Feb 7, 2013
                    Em 07-02-2013 11:19, Noel Jones escreveu:
                    Regardless of how you state the problem, it should already be clear that postfix does not have native capability to do selective BCC based on the subject.
                    Yes, it was already.

                    You might be able to find a milter that can do this; I haven't looked.
                    There is milter-bcc, commercial license. Found one and another for archiving purposes, badly documented and apparently not active anymore.

                     Your only sure bet is to have postfix BCC everything and use a sieve script after delivery to discard the unwanted messages.
                    I have only a couple hundred users, and one ongoing project with such need. But that solution doesn't scale well. This probably will become a standard for oncoming projects. Besides my small scale, consider engineers love to use SMTP as FTP, attaching big AutoCAD files up to 30MB. Consider a hundred folks working on a dozen different projects doing it. On a small busy box.

                    [thinking out loud -- amavisd-new has some archiving features built-in. Maybe it can be convinced to trigger on the Subject. Probably worth looking into.]
                    I understood postfix could not do it natively, that is the kind of advice I was hoping to get, sucking other's experience. :)

                    Thank you very much Noel.

                    --
                    Marcio Merlone
                  • Robert Schetterer
                    ... hi, look https://www.milter.org/milters under Archiving you may find an archive milter with additional features Best Regards MfG Robert Schetterer -- [*]
                    Message 9 of 16 , Feb 7, 2013
                      Am 07.02.2013 14:38, schrieb Marcio Merlone:
                      > Em 07-02-2013 11:19, Noel Jones escreveu:
                      >> Regardless of how you state the problem, it should already be clear
                      >> that postfix does not have native capability to do selective BCC based
                      >> on the subject.
                      > Yes, it was already.
                      >
                      >> You might be able to find a milter that can do this; I haven't looked.
                      > There is milter-bcc, commercial license. Found one and another for
                      > archiving purposes, badly documented and apparently not active anymore.
                      >
                      >> Your only sure bet is to have postfix BCC everything and use a sieve
                      >> script after delivery to discard the unwanted messages.
                      > I have only a couple hundred users, and one ongoing project with such
                      > need. But that solution doesn't scale well. This probably will become a
                      > standard for oncoming projects. Besides my small scale, consider
                      > engineers love to use SMTP as FTP, attaching big AutoCAD files up to
                      > 30MB. Consider a hundred folks working on a dozen different projects
                      > doing it. On a small busy box.
                      >
                      >> [thinking out loud -- amavisd-new has some archiving features
                      >> built-in. Maybe it can be convinced to trigger on the Subject.
                      >> Probably worth looking into.]
                      > I understood postfix could not do it natively, that is the kind of
                      > advice I was hoping to get, sucking other's experience. :)
                      >
                      > Thank you very much Noel.
                      >
                      > --
                      > Marcio Merlone

                      hi, look

                      https://www.milter.org/milters
                      under Archiving you may find an archive milter with additional features


                      Best Regards
                      MfG Robert Schetterer

                      --
                      [*] 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: Joerg Heidrich
                    • Ralf Hildebrandt
                      ... Another option would be to archive everything, and then discard the unwanted stuff. Admittedly not very elegant, but at least it s easy to implement! --
                      Message 10 of 16 , Feb 7, 2013
                        * Robert Schetterer <rs@...>:
                        > Am 07.02.2013 14:38, schrieb Marcio Merlone:
                        > > Em 07-02-2013 11:19, Noel Jones escreveu:
                        > >> Regardless of how you state the problem, it should already be clear
                        > >> that postfix does not have native capability to do selective BCC based
                        > >> on the subject.
                        > > Yes, it was already.

                        Another option would be to archive everything, and then discard the
                        unwanted stuff. Admittedly not very elegant, but at least it's easy to
                        implement!

                        --
                        [*] 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: Joerg Heidrich
                      • Michael Storz
                        ... How about using a smtp_header_checks with FILTER action which routes such emails to another postfix instance which will then bcc all emails? -- Michael
                        Message 11 of 16 , Feb 7, 2013
                          Am 2013-02-07 14:19, schrieb Noel Jones:
                          > On 2/7/2013 6:14 AM, Marcio Merlone wrote:
                          >> it must be transparent, based on subject.
                          >>
                          >> So, to work on incoming and outgoing mails regardless of rcpts it
                          >> has to be implemented on postifx. Can someone advice me on how can I
                          >> solve this?
                          >
                          > Regardless of how you state the problem, it should already be clear
                          > that postfix does not have native capability to do selective BCC
                          > based on the subject. Adding such a feature to the postfix core
                          > would require non-trivial redesign and won't happen anytime soon.
                          >
                          > You might be able to find a milter that can do this; I haven't
                          > looked. You might be able to modify an existing proxy, such as
                          > amavisd-new, to do this; that will take some work and an unknown
                          > amount of time.
                          >
                          > Your only sure bet is to have postfix BCC everything and use a sieve
                          > script after delivery to discard the unwanted messages.
                          >
                          > [thinking out loud -- amavisd-new has some archiving features
                          > built-in. Maybe it can be convinced to trigger on the Subject.
                          > Probably worth looking into.]
                          >
                          >
                          >
                          > -- Noel Jones

                          How about using a smtp_header_checks with FILTER action which routes
                          such emails to another postfix instance which will then bcc all emails?

                          --
                          Michael
                        • Noel Jones
                          ... Nice thought. smtp_header_checks can t change the destination, but you could use FILTER with regular header_checks. This could be made to work, but
                          Message 12 of 16 , Feb 7, 2013
                            On 2/7/2013 8:29 AM, Michael Storz wrote:
                            >
                            > How about using a smtp_header_checks with FILTER action which routes
                            > such emails to another postfix instance which will then bcc all emails?

                            Nice thought. smtp_header_checks can't change the destination, but
                            you could use FILTER with regular header_checks. This could be made
                            to work, but doesn't seem like a very good solution because of the
                            complex mail routing involved. I think using amavisd-new is the
                            most promising idea.


                            -- Noel Jones
                          • Noel Jones
                            ... This could still scale reasonably well if you BCC everything to one project-archive user and use sieve to sort the different projects into individual
                            Message 13 of 16 , Feb 7, 2013
                              On 2/7/2013 7:38 AM, Marcio Merlone wrote:
                              > Em 07-02-2013 11:19, Noel Jones escreveu:
                              >> Your only sure bet is to have postfix BCC everything and use a
                              >> sieve script after delivery to discard the unwanted messages.

                              > I have only a couple hundred users, and one ongoing project with
                              > such need. But that solution doesn't scale well. This probably will
                              > become a standard for oncoming projects. Besides my small scale,
                              > consider engineers love to use SMTP as FTP, attaching big AutoCAD
                              > files up to 30MB. Consider a hundred folks working on a dozen
                              > different projects doing it. On a small busy box.

                              This could still scale reasonably well if you BCC everything to one
                              project-archive user and use sieve to sort the different projects
                              into individual mailboxes, discarding anything without a project
                              tag. It might even be possible to convince sieve to create project
                              mailboxes automatically so you don't have to touch it every time a
                              new project comes up!

                              (sounds like what you really need is a project management system
                              that handles all communications, and not use email directly. I
                              suppose you're trying to do this with postfix because existing
                              solutions are either too costly, suck, or both.)


                              -- Noel Jones
                            • Marcio Merlone
                              ... The first idea was one mailbox per project, but we can rethink that.... ... Bingo! :) We do need to keep email archives, but not just email. We already
                              Message 14 of 16 , Feb 7, 2013
                                Em 07-02-2013 13:08, Noel Jones escreveu:
                                > On 2/7/2013 7:38 AM, Marcio Merlone wrote:
                                >> I have only a couple hundred users, and one ongoing project with
                                >> such need. But that solution doesn't scale well. This probably will
                                >> become a standard for oncoming projects. Besides my small scale,
                                >> consider engineers love to use SMTP as FTP, attaching big AutoCAD
                                >> files up to 30MB. Consider a hundred folks working on a dozen
                                >> different projects doing it. On a small busy box.
                                > This could still scale reasonably well if you BCC everything to one
                                > project-archive user and use sieve to sort the different projects
                                > into individual mailboxes, discarding anything without a project
                                > tag. It might even be possible to convince sieve to create project
                                > mailboxes automatically so you don't have to touch it every time a
                                > new project comes up!
                                The first idea was one mailbox per project, but we can rethink that....

                                > (sounds like what you really need is a project management system
                                > that handles all communications, and not use email directly. I
                                > suppose you're trying to do this with postfix because existing
                                > solutions are either too costly, suck, or both.)
                                Bingo! :)
                                We do need to keep email archives, but not just email. We already handle
                                other media with other individual solutions. I am trying to adjust our
                                existing structure to new needs. If no other solution, will have to turn
                                to paid solutions, like SharePoint or whatever, even though I'd like to
                                stick to OSS.

                                --
                                Marcio Merlone
                              • Robert Schetterer
                                ... hi Noel, what about using a separate bcc transport to archive domain with smtp_header_checks pcre if subject REDIRECT user@domain all other DISCARD ? Best
                                Message 15 of 16 , Feb 7, 2013
                                  Am 07.02.2013 15:55, schrieb Noel Jones:
                                  > On 2/7/2013 8:29 AM, Michael Storz wrote:
                                  >>
                                  >> How about using a smtp_header_checks with FILTER action which routes
                                  >> such emails to another postfix instance which will then bcc all emails?
                                  >
                                  > Nice thought. smtp_header_checks can't change the destination, but
                                  > you could use FILTER with regular header_checks. This could be made
                                  > to work, but doesn't seem like a very good solution because of the
                                  > complex mail routing involved. I think using amavisd-new is the
                                  > most promising idea.
                                  >
                                  >
                                  > -- Noel Jones
                                  >

                                  hi Noel, what about using a separate bcc transport to archive domain with
                                  smtp_header_checks pcre if subject REDIRECT user@domain
                                  all other DISCARD ?


                                  Best Regards
                                  MfG Robert Schetterer

                                  --
                                  [*] 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: Joerg Heidrich
                                • Noel Jones
                                  ... smtp_header_checks can t change the destination, so no REDIRECT and no DISCARD. I suppose you could BCC everything to a separate postfix instance
                                  Message 16 of 16 , Feb 7, 2013
                                    On 2/7/2013 10:12 AM, Robert Schetterer wrote:
                                    > Am 07.02.2013 15:55, schrieb Noel Jones:
                                    >> On 2/7/2013 8:29 AM, Michael Storz wrote:
                                    >>>
                                    >>> How about using a smtp_header_checks with FILTER action which routes
                                    >>> such emails to another postfix instance which will then bcc all emails?
                                    >>
                                    >> Nice thought. smtp_header_checks can't change the destination, but
                                    >> you could use FILTER with regular header_checks. This could be made
                                    >> to work, but doesn't seem like a very good solution because of the
                                    >> complex mail routing involved. I think using amavisd-new is the
                                    >> most promising idea.
                                    >>
                                    >>
                                    >> -- Noel Jones
                                    >>
                                    >
                                    > hi Noel, what about using a separate bcc transport to archive domain with
                                    > smtp_header_checks pcre if subject REDIRECT user@domain
                                    > all other DISCARD ?
                                    >

                                    smtp_header_checks can't change the destination, so no REDIRECT and
                                    no DISCARD.

                                    I suppose you could BCC everything to a separate postfix instance
                                    (transport table entry for the bcc recipient that points to a
                                    separate instance) and use header_checks in the second postfix to
                                    DISCARD non-matching subjects. Mail without a Subject: would not be
                                    discarded; header_checks can't test for missing headers. This might
                                    work, but I'd be concerned about mail loops.

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