Accessing mail body on postfix check_policy_service event

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I followed postfix documentation to set up a script that I can use to write custom filters on incoming mail on the check_policy_service event and it works just fine, but I cannot access the email body - only the following parameters from STDIN:



Array
(
[request] => smtpd_access_policy
[protocol_state] => RCPT
[protocol_name] => ESMTP
[client_address] => 208.40.44.179
[client_name] => smtprelay0179.hostedemail.com
[client_port] => 59713
[reverse_client_name] => smtprelay0179.hostedemail.com
[helo_name] => smtprelay.hostedemail.com
[sender] => john@doe.net
[recipient] => mary@doe.com
[recipient_count] => 0
[queue_id] =>
[instance] => 27c5.5bccec9c.5f5b9.0
[size] => 1905
[etrn_domain] =>
[stress] =>
[sasl_method] =>
[sasl_username] =>
[sasl_sender] =>
[ccert_subject] =>
[ccert_issuer] =>
[ccert_fingerprint] =>
[ccert_pubkey_fingerprint] =>
[encryption_protocol] => TLSv1.2
[encryption_cipher] => AECDH-AES256-SHA
[encryption_keysize] => 256
[policy_context] =>
)


How can I access the raw email (headers and body) so that my filtering can optionally depend on that as well?










share|improve this question

























    up vote
    1
    down vote

    favorite












    I followed postfix documentation to set up a script that I can use to write custom filters on incoming mail on the check_policy_service event and it works just fine, but I cannot access the email body - only the following parameters from STDIN:



    Array
    (
    [request] => smtpd_access_policy
    [protocol_state] => RCPT
    [protocol_name] => ESMTP
    [client_address] => 208.40.44.179
    [client_name] => smtprelay0179.hostedemail.com
    [client_port] => 59713
    [reverse_client_name] => smtprelay0179.hostedemail.com
    [helo_name] => smtprelay.hostedemail.com
    [sender] => john@doe.net
    [recipient] => mary@doe.com
    [recipient_count] => 0
    [queue_id] =>
    [instance] => 27c5.5bccec9c.5f5b9.0
    [size] => 1905
    [etrn_domain] =>
    [stress] =>
    [sasl_method] =>
    [sasl_username] =>
    [sasl_sender] =>
    [ccert_subject] =>
    [ccert_issuer] =>
    [ccert_fingerprint] =>
    [ccert_pubkey_fingerprint] =>
    [encryption_protocol] => TLSv1.2
    [encryption_cipher] => AECDH-AES256-SHA
    [encryption_keysize] => 256
    [policy_context] =>
    )


    How can I access the raw email (headers and body) so that my filtering can optionally depend on that as well?










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I followed postfix documentation to set up a script that I can use to write custom filters on incoming mail on the check_policy_service event and it works just fine, but I cannot access the email body - only the following parameters from STDIN:



      Array
      (
      [request] => smtpd_access_policy
      [protocol_state] => RCPT
      [protocol_name] => ESMTP
      [client_address] => 208.40.44.179
      [client_name] => smtprelay0179.hostedemail.com
      [client_port] => 59713
      [reverse_client_name] => smtprelay0179.hostedemail.com
      [helo_name] => smtprelay.hostedemail.com
      [sender] => john@doe.net
      [recipient] => mary@doe.com
      [recipient_count] => 0
      [queue_id] =>
      [instance] => 27c5.5bccec9c.5f5b9.0
      [size] => 1905
      [etrn_domain] =>
      [stress] =>
      [sasl_method] =>
      [sasl_username] =>
      [sasl_sender] =>
      [ccert_subject] =>
      [ccert_issuer] =>
      [ccert_fingerprint] =>
      [ccert_pubkey_fingerprint] =>
      [encryption_protocol] => TLSv1.2
      [encryption_cipher] => AECDH-AES256-SHA
      [encryption_keysize] => 256
      [policy_context] =>
      )


      How can I access the raw email (headers and body) so that my filtering can optionally depend on that as well?










      share|improve this question













      I followed postfix documentation to set up a script that I can use to write custom filters on incoming mail on the check_policy_service event and it works just fine, but I cannot access the email body - only the following parameters from STDIN:



      Array
      (
      [request] => smtpd_access_policy
      [protocol_state] => RCPT
      [protocol_name] => ESMTP
      [client_address] => 208.40.44.179
      [client_name] => smtprelay0179.hostedemail.com
      [client_port] => 59713
      [reverse_client_name] => smtprelay0179.hostedemail.com
      [helo_name] => smtprelay.hostedemail.com
      [sender] => john@doe.net
      [recipient] => mary@doe.com
      [recipient_count] => 0
      [queue_id] =>
      [instance] => 27c5.5bccec9c.5f5b9.0
      [size] => 1905
      [etrn_domain] =>
      [stress] =>
      [sasl_method] =>
      [sasl_username] =>
      [sasl_sender] =>
      [ccert_subject] =>
      [ccert_issuer] =>
      [ccert_fingerprint] =>
      [ccert_pubkey_fingerprint] =>
      [encryption_protocol] => TLSv1.2
      [encryption_cipher] => AECDH-AES256-SHA
      [encryption_keysize] => 256
      [policy_context] =>
      )


      How can I access the raw email (headers and body) so that my filtering can optionally depend on that as well?







      email postfix






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      TheStoryCoder

      1336




      1336




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          Access policy delegation doesn't transmit the message body. You'll need to create a milter instead, if you need access to the message body.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "2"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f936548%2faccessing-mail-body-on-postfix-check-policy-service-event%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            Access policy delegation doesn't transmit the message body. You'll need to create a milter instead, if you need access to the message body.






            share|improve this answer
























              up vote
              2
              down vote













              Access policy delegation doesn't transmit the message body. You'll need to create a milter instead, if you need access to the message body.






              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                Access policy delegation doesn't transmit the message body. You'll need to create a milter instead, if you need access to the message body.






                share|improve this answer












                Access policy delegation doesn't transmit the message body. You'll need to create a milter instead, if you need access to the message body.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 16 mins ago









                Michael Hampton♦

                158k26295597




                158k26295597



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f936548%2faccessing-mail-body-on-postfix-check-policy-service-event%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    Installing NextGIS Connect into QGIS 3?

                    One-line joke