Log from Sendmail and PHP












1















If I leave my default sendmail options set in php.ini it works fine and sends an email. However if I change the sendmail path to:



sendmail_path = "sendmail -t -i -x /var/log/mail.log"


mail() returns false.



If I run:



ls -l /var/mail/mail.log


I get:



-rwxrw-rw- 1 www-data www-data 0 Sep 17 14:49 /var/mail/mail.log


Which I believe is correct. All I want sendmail to do is log my emails but for some reason it really really doesn't want to play ball!



Just for clarity - this isn't the mail.log parameter which logs the PHP interactions with the script. The output when this is set is something like this:



[17-Sep-2016 15:38:20 Europe/London] mail() on [/home/server/www/dev1/htdocs/mail.php:15]: To: TO -- Headers: MIME-Version: 1.0  From: ME









share|improve this question





























    1















    If I leave my default sendmail options set in php.ini it works fine and sends an email. However if I change the sendmail path to:



    sendmail_path = "sendmail -t -i -x /var/log/mail.log"


    mail() returns false.



    If I run:



    ls -l /var/mail/mail.log


    I get:



    -rwxrw-rw- 1 www-data www-data 0 Sep 17 14:49 /var/mail/mail.log


    Which I believe is correct. All I want sendmail to do is log my emails but for some reason it really really doesn't want to play ball!



    Just for clarity - this isn't the mail.log parameter which logs the PHP interactions with the script. The output when this is set is something like this:



    [17-Sep-2016 15:38:20 Europe/London] mail() on [/home/server/www/dev1/htdocs/mail.php:15]: To: TO -- Headers: MIME-Version: 1.0  From: ME









    share|improve this question



























      1












      1








      1








      If I leave my default sendmail options set in php.ini it works fine and sends an email. However if I change the sendmail path to:



      sendmail_path = "sendmail -t -i -x /var/log/mail.log"


      mail() returns false.



      If I run:



      ls -l /var/mail/mail.log


      I get:



      -rwxrw-rw- 1 www-data www-data 0 Sep 17 14:49 /var/mail/mail.log


      Which I believe is correct. All I want sendmail to do is log my emails but for some reason it really really doesn't want to play ball!



      Just for clarity - this isn't the mail.log parameter which logs the PHP interactions with the script. The output when this is set is something like this:



      [17-Sep-2016 15:38:20 Europe/London] mail() on [/home/server/www/dev1/htdocs/mail.php:15]: To: TO -- Headers: MIME-Version: 1.0  From: ME









      share|improve this question
















      If I leave my default sendmail options set in php.ini it works fine and sends an email. However if I change the sendmail path to:



      sendmail_path = "sendmail -t -i -x /var/log/mail.log"


      mail() returns false.



      If I run:



      ls -l /var/mail/mail.log


      I get:



      -rwxrw-rw- 1 www-data www-data 0 Sep 17 14:49 /var/mail/mail.log


      Which I believe is correct. All I want sendmail to do is log my emails but for some reason it really really doesn't want to play ball!



      Just for clarity - this isn't the mail.log parameter which logs the PHP interactions with the script. The output when this is set is something like this:



      [17-Sep-2016 15:38:20 Europe/London] mail() on [/home/server/www/dev1/htdocs/mail.php:15]: To: TO -- Headers: MIME-Version: 1.0  From: ME






      php sendmail






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 17 '16 at 14:40







      Antony

















      asked Sep 17 '16 at 13:59









      AntonyAntony

      11927




      11927






















          2 Answers
          2






          active

          oldest

          votes


















          1














          The problem in this instance was that I was using -x and not -X. Once I did the capital it worked fine!






          share|improve this answer
























          • Apparently this should be the accepted answer.

            – pa4080
            Jan 21 at 8:15



















          0














          If you use PHP version 5.3.0 or newer then correct answer will be to use mail.log directive in configuration like said in manual.






          share|improve this answer
























          • I believe this is the PHP log not the mail log itself.

            – Antony
            Sep 17 '16 at 14:10











          • And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

            – Igor Shipenkov
            Sep 17 '16 at 14:20













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f826127%2flog-from-sendmail-and-php%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The problem in this instance was that I was using -x and not -X. Once I did the capital it worked fine!






          share|improve this answer
























          • Apparently this should be the accepted answer.

            – pa4080
            Jan 21 at 8:15
















          1














          The problem in this instance was that I was using -x and not -X. Once I did the capital it worked fine!






          share|improve this answer
























          • Apparently this should be the accepted answer.

            – pa4080
            Jan 21 at 8:15














          1












          1








          1







          The problem in this instance was that I was using -x and not -X. Once I did the capital it worked fine!






          share|improve this answer













          The problem in this instance was that I was using -x and not -X. Once I did the capital it worked fine!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 17 '16 at 15:24









          AntonyAntony

          11927




          11927













          • Apparently this should be the accepted answer.

            – pa4080
            Jan 21 at 8:15



















          • Apparently this should be the accepted answer.

            – pa4080
            Jan 21 at 8:15

















          Apparently this should be the accepted answer.

          – pa4080
          Jan 21 at 8:15





          Apparently this should be the accepted answer.

          – pa4080
          Jan 21 at 8:15













          0














          If you use PHP version 5.3.0 or newer then correct answer will be to use mail.log directive in configuration like said in manual.






          share|improve this answer
























          • I believe this is the PHP log not the mail log itself.

            – Antony
            Sep 17 '16 at 14:10











          • And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

            – Igor Shipenkov
            Sep 17 '16 at 14:20


















          0














          If you use PHP version 5.3.0 or newer then correct answer will be to use mail.log directive in configuration like said in manual.






          share|improve this answer
























          • I believe this is the PHP log not the mail log itself.

            – Antony
            Sep 17 '16 at 14:10











          • And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

            – Igor Shipenkov
            Sep 17 '16 at 14:20
















          0












          0








          0







          If you use PHP version 5.3.0 or newer then correct answer will be to use mail.log directive in configuration like said in manual.






          share|improve this answer













          If you use PHP version 5.3.0 or newer then correct answer will be to use mail.log directive in configuration like said in manual.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 17 '16 at 14:04









          Igor ShipenkovIgor Shipenkov

          613




          613













          • I believe this is the PHP log not the mail log itself.

            – Antony
            Sep 17 '16 at 14:10











          • And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

            – Igor Shipenkov
            Sep 17 '16 at 14:20





















          • I believe this is the PHP log not the mail log itself.

            – Antony
            Sep 17 '16 at 14:10











          • And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

            – Igor Shipenkov
            Sep 17 '16 at 14:20



















          I believe this is the PHP log not the mail log itself.

          – Antony
          Sep 17 '16 at 14:10





          I believe this is the PHP log not the mail log itself.

          – Antony
          Sep 17 '16 at 14:10













          And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

          – Igor Shipenkov
          Sep 17 '16 at 14:20







          And I believe your sendmail -t -i command just deliver mail to local mailer daemon which already log all that related to mail delivery. Try to look in /var/log/mail.log or something - maybe you already have all logs you need.

          – Igor Shipenkov
          Sep 17 '16 at 14:20




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f826127%2flog-from-sendmail-and-php%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Questions related to Moebius Transform of Characteristic Function of the Primes

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

          List of scandals in India