Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    Use pfsense notification/SMTP function in sgerror.php (squidguard) - help

    Scheduled Pinned Locked Moved General pfSense Questions
    5 Posts 2 Posters 2.4k 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.
    • N
      Nachtfalke
      last edited by

      Hi,

      I am not good in php and web technologgies so I asked a colleague to modify parts of the sgerror.php of squidguard to give the user the ability to send me an e-mail with the blocked URL and a comment so that I am able to unblock the URL.

      My colleague used sendmail for php but it does not work and we found out that sendmail seems not to be installed/running on pfsense.

      Now my idea is to use the SMTP credentials uses unter SYSTEM โ€“> ADVANCED --> NOTIFICATIONS in this sgerror.php file to authenticate on the destination E-Mail server.
      Easiest would be probably to "steal" the function from a pfsense file which for example triggers "gateway down" event. Then "just" put this function into the sgerror.php and that's it.

      So where to find the function which triggers an E-Mail event for "Gateway down" or something else?
      Or did anyone else built a sgerror.php which can already do what I want?

      Thank you very much for your feedback!

      1 Reply Last reply
      Reply Quote 0
      • N
        Nachtfalke
        last edited by

        Hi,

        I tried to install sendmail on my pfsense 2.0.3 with freebsd 8.1 from this location:

        
        pkg_add -r http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/8.1-RELEASE/packages/All/sendmail-8.14.4_2.tbz
        
        

        It is now ih the list when doing

        
        pkg_info
        
        

        but I cannot find the confi file like

        
        sendmail.cf
        
        

        Isn't that the correct way to install an additional package which is not available in the package manager of pfsense?

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

          We don't include a config file for sendmail, you'd have to make one.

          But sendmail is way overkill.

          Look at what I did for the arpwatch package a couple weeks back. A small php script that gets dropped in where sendmail would go, and lets programs get mail out.

          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
          • N
            Nachtfalke
            last edited by

            @jimp:

            We don't include a config file for sendmail, you'd have to make one.

            But sendmail is way overkill.

            Look at what I did for the arpwatch package a couple weeks back. A small php script that gets dropped in where sendmail would go, and lets programs get mail out.

            You probably mean this one:
            https://github.com/pfsense/pfsense-packages/blob/master/config/sm.php

            Unfortunately I am still using pfsense 2.0.3 and not 2.1.

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

              Then get with the times already and upgrade :-)

              It's not an unreasonable restriction these days. The function that script calls only exists on 2.1.

              Sure it could be done on 2.0.x but it means copying a bunch of code and a lot of extra work.

              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

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better ๐Ÿ’—

              Register Login
              • First post
                Last post
              Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
              Privacy Policy · Cookie Policy