Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    /usr/local/bin/mail.php is only executed from the console

    Scheduled Pinned Locked Moved pfSense Packages
    20 Posts 7 Posters 5.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      Lanes
      last edited by

      Unfortunately I have not had any time to research any more into this myself for the past week, so thanks for your efforts. Do we believe this to be a bug, or just some misconfiguration of pfsense/nut?

      I have a few things I want to test when given the opportunity:

      1. Can the NOTIFYCMD script call / execute any non-php file
      2. Does the issue remain if we set NUT to use upssched, and then call the php script via the CMDSCRIPT variable instead
      3. Does the issue remain if we do write the commands inline in upsmon (NOTIFYCMD = 'do stuff here')
      1 Reply Last reply Reply Quote 0
      • L
        Lanes
        last edited by

        I got bored trying to find a solution for this issue back in August, and I have not looked at it until today. Since August there has been a few updates of the NUT package that I silently hoped would fix my issue, but no luck. I still can't get any php script to trigger from NUT, and I am at a loss where to look next.

        Where can I report this issue?

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          have you tried:

          /usr/local/bin/php -f /usr/local/bin/mail.php
          

          Rather than executing it directly?

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • L
            Lanes
            last edited by

            Tried that, and I have lost count for how many variations I have tried. It just won't execute the php. I am now using the same script as Gertjan posted above to test, and I have the exact same results as he.

            1 Reply Last reply Reply Quote 0
            • R
              ryan87
              last edited by

              I have the same issue.  I've never been able to get it working.  There's a related feature request here.

              1 Reply Last reply Reply Quote 0
              • L
                Lanes
                last edited by

                Good find ryanjaeb, I had not come across that for all my searching. I am a bit disappointed by the feature not being in place, but at least it appears the issue is not on my end.

                On a related topic: How do you guys then monitor the status of your UPS? I suppose I can create a separate log file, and possibly monitor that for changes to send email notifications. It would not be instant, but it could work.

                1 Reply Last reply Reply Quote 0
                • L
                  larathydo
                  last edited by

                  Hi Everyone,

                  I'm going absolutely mad myself trying to get email notification functionality to work via the NUT package and NOTIFYCMD via upsmon.conf options.

                  Has anyone been able to get this to work? I too tried to use mail.php but nothing ever happens. The same command in the console works just great.

                  Can anyone think of another alternative method to facilitate basic email functionality though something other than mail.php if we're hitting this limitation? As in, I wonder if we could still call a script via NOTIFYCMD but instead of the script relying on mail.php, it could use some other mechanism to send the email?

                  This is so aggravating! Has anyone ever got NUT email functionality to work in any way-shape-form?

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    FYI- Though NUT is not yet on 2.3, using mail.php from the GUI and elsewhere appears to work on 2.3 where it did not on 2.2.x. Might be the difference in PHP versions or other changes to PHP handling, but at least from the tests I was able to run, it sent messages to me when it wouldn't otherwise.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • C
                      Carltonson-sky
                      last edited by

                      hi everybody,

                      Can you tell me how to use mail.php under 2.3 release please. I’m looking for the syntax but without success. can you give me an example ? I try to send an email to the people who filled my php form.
                      Thanks in advance

                      cheers

                      1 Reply Last reply Reply Quote 0
                      • jimpJ
                        jimp Rebel Alliance Developer Netgate
                        last edited by

                        @Carltonson-sky:

                        Can you tell me how to use mail.php under 2.3 release please. I’m looking for the syntax but without success. can you give me an example ? I try to send an email to the people who filled my php form.

                        Not likely to be usable for that. It's for basic mail from the CLI:

                        echo test | mail.php -s="Blah"
                        

                        Start a new thread in the appropriate forum (not here) and maybe someone can help come up with a way to do what you're after.

                        Hosting a form like that on the firewall is not something we'd recommend, however.

                        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                        Need help fast? Netgate Global Support!

                        Do not Chat/PM for help!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.