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

Reporting redirects - API call similar to "sendmail -bv"

Expand Messages
  • Simon Waters
    I suspect I know the answer - but it doesn t hurt to ask. I have a Postfix config set up which uses 4 mysql maps to create role based emails for a (large) set
    Message 1 of 5 , May 1 2:02 AM
    • 0 Attachment
      I suspect I know the answer - but it doesn't hurt to ask.

      I have a Postfix config set up which uses 4 mysql maps to create role
      based emails for a (large) set of clubs.

      The rules in the SQL aren't stunningly complex but they are non-trivial.
      I'd prefer not to implement them in several places, because I know they
      will get out of sync if that is done.

      They handle cases like there is a temporary redirect in place for the
      role, the club post isn't filled so send to the secretary, the new
      committee takes over so all the roles shuffled around because of year
      change. Several posts have multiple aliases. Some clubs haven't signed
      up to the system. You can imagine the sort of thing that apply if you've
      ever been in a club with a formal constitution.

      Two of the maps check addresses for validity of an address (e.g.
      role@domain are valid role and valid domain). There are two types of
      club, one map each.

      Two of the maps transfer us from virtual address to final delivery
      address (secretary@domain -> simonw@...). Again the same division,
      two types of club, one map each.

      The main reason to keep these separate for types of club is simplicity
      of thinking, Postfix doesn't care, and indeed does slightly more work
      because there are 4 maps instead of 2.


      I now want to produce some reporting based on these mappings.

      The output I want initially is what "sendmail -bv" was invented for, the
      mapping from role email to actual email.

      I'm assuming from the "sendmail -bv" discussion in archives that Postfix
      doesn't allow me to make this query, in general, without simply feeding
      an email through the system? e.g.. "sendmail -bv" works in exactly that
      way, presumably for similar reasons? Or is there an exposed API
      somewhere that answers the same question?

      Otherwise I suspect either I should push the query logic into stored
      procedures in the database (rather than Postfix files), and call them
      directly when generating the report. Or possibly a setuid script to call
      "postmap -q" (yuck).

      Simon
    • Wietse Venema
      ... sendmail -bv is useful because it reproduces all the steps of address transformation of a real email message. The reason it can do this is that it
      Message 2 of 5 , May 1 7:31 AM
      • 0 Attachment
        Simon Waters:
        > doesn't allow me to make this query, in general, without simply feeding
        > an email through the system? e.g.. "sendmail -bv" works in exactly that
        > way, presumably for similar reasons? Or is there an exposed API
        > somewhere that answers the same question?

        "sendmail -bv" is useful because it reproduces all the steps of
        address transformation of a real email message. The reason it can
        do this is that it actually sends an email message through Postfix.

        There is no alternate code path that does the same thing. It would
        be problematic to have two different things doing the exact same
        thing for 14 years.

        Is there any problem with using "sendmail -bv"? The output format
        (the second and thord part) is meant to be machine-readable.

        Wietse
      • Simon Waters
        ... I want to report the value of 30 or 40 redirects in a single web page. I want to generate that report when someone requests that web page, since they ll do
        Message 3 of 5 , May 1 8:15 AM
        • 0 Attachment
          On 01/05/13 15:31, Wietse Venema wrote:
          >
          > Is there any problem with using "sendmail -bv"? The output format
          > (the second and thord part) is meant to be machine-readable.

          I want to report the value of 30 or 40 redirects in a single web page.

          I want to generate that report when someone requests that web page,
          since they'll do it immediately after updating someone's details to see
          if they got it right.

          I guess I could generate the "sendmail -bv" requests, and parse them,
          and dump the resulting mapping back in a database table along with the
          "last updated" showing when it was processed.

          But it all feels a bit unsynchronized and inelegant...

          Ah - also looks like "sendmail -bv" triggers address verification each
          time (which makes sense as that is part of how I decide to accept an
          email for delivery). Thus that approach is potentially going to generate
          too many address verification probes.

          Obviously "sendmail -bv" is potentially a "better answer" than calling
          the SQL query directly since Postfix "knows" more, but looks like
          calling the SQL it is.

          Secondary question - can I force the output of "sendmail -bv" to go to a
          specific email address - seems always to go to the invoker - e.g. can I
          easily send this to the end users email address (which I know). Since an
          option to get a delivery report might help keep them happy even if it is
          rarely used. Especially as it includes output from the verification probe.

          Simon
        • Axel Luttgens
          ... Hello Simon, Have you tried with the -f option? HTH, Axel
          Message 4 of 5 , May 2 12:12 AM
          • 0 Attachment
            Le 1 mai 2013 à 17:15, Simon Waters a écrit :

            > [...]
            >
            > Secondary question - can I force the output of "sendmail -bv" to go to a specific email address - seems always to go to the invoker - e.g. can I easily send this to the end users email address (which I know). Since an option to get a delivery report might help keep them happy even if it is rarely used. Especially as it includes output from the verification probe.

            Hello Simon,

            Have you tried with the -f option?

            HTH,
            Axel
          • Simon Waters
            ... I had but not with the options before the recipient as specified in the manual page (doh). Sorry.
            Message 5 of 5 , May 2 1:30 AM
            • 0 Attachment
              On 02/05/13 08:12, Axel Luttgens wrote:
              > Le 1 mai 2013 à 17:15, Simon Waters a écrit :
              >
              >> [...]
              >>
              >> Secondary question - can I force the output of "sendmail -bv" to go
              >> to a specific email address - seems always to go to the invoker -
              >> e.g. can I easily send this to the end users email address (which I
              >> know). Since an option to get a delivery report might help keep
              >> them happy even if it is rarely used. Especially as it includes
              >> output from the verification probe.
              >
              > Have you tried with the -f option?

              I had but not with the options before the "recipient" as specified in
              the manual page (doh). Sorry.
            Your message has been successfully submitted and would be delivered to recipients shortly.