Send HTML Email, with Attachments
-
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!
-
@arrmo It's a firewall, not an email client.
-
@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!
-
@arrmo Use a remote syslog server, that's the only correct way.
-
@nollipfsense Will give that a try. Was just hoping sendmail, or mailx (or mutt?) was a possibility in some way.
Thanks.
-
@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.
-
@gertjan Good to know ... thank you for sharing!
-
@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.
-
@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. -
@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!
-
For future ref. phpmailer is included in the mailreport package