• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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.
  • A
    arrmo
    last edited by May 19, 2021, 9:50 PM

    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!

    N 1 Reply Last reply May 19, 2021, 10:57 PM Reply Quote 0
    • N
      NollipfSense @arrmo
      last edited by May 19, 2021, 10:57 PM

      @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.

      A 1 Reply Last reply May 19, 2021, 10:59 PM Reply Quote 0
      • A
        arrmo @NollipfSense
        last edited by May 19, 2021, 10:59 PM

        @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!

        N 1 Reply Last reply May 19, 2021, 11:02 PM Reply Quote 0
        • N
          NollipfSense @arrmo
          last edited by May 19, 2021, 11:02 PM

          @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.

          A 1 Reply Last reply May 19, 2021, 11:50 PM Reply Quote 0
          • A
            arrmo @NollipfSense
            last edited by May 19, 2021, 11:50 PM

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

            Thanks.

            G 1 Reply Last reply May 20, 2021, 6:05 AM Reply Quote 0
            • G
              Gertjan @arrmo
              last edited by Gertjan May 20, 2021, 6:07 AM May 20, 2021, 6:05 AM

              @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 ??

              N A 2 Replies Last reply May 20, 2021, 3:33 PM Reply Quote 0
              • N
                NollipfSense @Gertjan
                last edited by May 20, 2021, 3:33 PM

                @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
                • A
                  arrmo @Gertjan
                  last edited by May 20, 2021, 6:50 PM

                  @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.

                  G 1 Reply Last reply May 21, 2021, 5:56 AM Reply Quote 0
                  • G
                    Gertjan @arrmo
                    last edited by Gertjan May 21, 2021, 6:00 AM May 21, 2021, 5:56 AM

                    @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 ??

                    A 1 Reply Last reply May 21, 2021, 10:21 PM Reply Quote 1
                    • A
                      arrmo @Gertjan
                      last edited by May 21, 2021, 10:21 PM

                      @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 Jul 24, 2024, 1:58 PM

                        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.
                          This community forum collects and processes your personal information.
                          consent.not_received