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

    Send HTML Email, with Attachments

    Scheduled Pinned Locked Moved General pfSense Questions
    11 Posts 4 Posters 1.0k 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.
    • arrmoA
      arrmo
      last edited by

      Hi,

      I have no issues sending (basic) email using /usr/local/bin/mail.php => works just fine. But ... I would like to be able to send HTML formatted email, and also add attachments, but it seems that this basic mail interface doesn't support that. Is there a way to do this in pfSense?

      Thanks!

      NollipfSenseN 1 Reply Last reply Reply Quote 0
      • NollipfSenseN
        NollipfSense @arrmo
        last edited by

        @arrmo It's a firewall, not an email client.

        pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
        pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

        arrmoA 1 Reply Last reply Reply Quote 0
        • arrmoA
          arrmo @NollipfSense
          last edited by

          @nollipfsense LOL - yes, understood (and agreed!). But I want to send out, for example, log files (with details) if certain firewall rules are violated. Not a big thing, just would be nice / handy.

          Thanks!

          NollipfSenseN 1 Reply Last reply Reply Quote 0
          • NollipfSenseN
            NollipfSense @arrmo
            last edited by

            @arrmo Use a remote syslog server, that's the only correct way.

            pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
            pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

            arrmoA 1 Reply Last reply Reply Quote 0
            • arrmoA
              arrmo @NollipfSense
              last edited by

              @nollipfsense Will give that a try. Was just hoping sendmail, or mailx (or mutt?) was a possibility in some way.

              Thanks.

              GertjanG 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @arrmo
                last edited by Gertjan

                @arrmo said in Send HTML Email, with Attachments:

                hoping sendmail, or mailx (or mutt?)

                Well, Outlook 365 isn't there neither, but who cares, as the creation of mail should be automated anyway.
                So, there is another option - and it's already present.
                Look here : /etc/inc/phpmailer and you find one file : class.phpmailer.php
                That worlds most used and documented PHP mini mail 'client'. Every site on planet earth that uses PHP uses or used this "PHPMailer".

                See here for guide lines : source and and good example is here.

                Now, all you have to do is :
                Install the pfSense cron package.
                Add a line that executes ones a (example) day :

                /usr/local/bin/php -q /root/daily-mail-with-flags-and-whistles.php
                

                The "daily-mail-with-flags-and-whistles.php" is to be placed in /root/, just like the example.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                NollipfSenseN arrmoA 2 Replies Last reply Reply Quote 0
                • NollipfSenseN
                  NollipfSense @Gertjan
                  last edited by

                  @gertjan Good to know ... thank you for sharing!

                  pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
                  pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

                  1 Reply Last reply Reply Quote 0
                  • arrmoA
                    arrmo @Gertjan
                    last edited by

                    @gertjan said in Send HTML Email, with Attachments:

                    That worlds most used and documented PHP mini mail 'client'. Every site on planet earth that uses PHP uses or used this "PHPMailer".

                    Sounds great, thanks! But ... I don't seem to have that file /etc/inc/phpmailer. Hmmm ... is it part of a package install?

                    Running v2.5.0.

                    Thanks again.

                    GertjanG 1 Reply Last reply Reply Quote 0
                    • GertjanG
                      Gertjan @arrmo
                      last edited by Gertjan

                      @arrmo said in Send HTML Email, with Attachments:

                      I don't seem to have that file /etc/inc/phpmailer. Hmmm ... is it part of a package install?

                      Strange. It's a my pfSense, and probably a left over from an ancient version. A new install doesn't include phpmailer.

                      edit : package : I don't think so.
                      I've NUT, Notes, cron, acme, VPN-Export, pfBlockerNG-devel, Avahi, Shellcmd and System_patches.
                      It might have been 'NUT' from the past, but this one it now using the build in pfSense "mail facilities".

                      No big deal, as would advise anyway to use the latest version from the source mentioned above.
                      If, and only if you're guys a comfortable with copying a file and don't bother coping 'unknown' scripts code on your firewall.

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      arrmoA 1 Reply Last reply Reply Quote 1
                      • arrmoA
                        arrmo @Gertjan
                        last edited by

                        @gertjan said in Send HTML Email, with Attachments:

                        If, and only if you're guys a comfortable with copying a file and don't bother coping 'unknown' scripts code on your firewall.

                        Yep, that makes sense. Appreciate the pointers!

                        1 Reply Last reply Reply Quote 0
                        • C
                          czuk
                          last edited by

                          For future ref. phpmailer is included in the mailreport package

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