PHP Mail Function on Custom Squid Error Page
SpankIt last edited by
I've successfully created a custom error page for squidguard when a website is blocked by the content filter. I would like to add a button on the page that will allow the client to contact me in order to alert me of websites that should not be blocked. In reading up on this functionality in php it has come to my attention that I will require a mail program installed on the firewall along with some configuration changes to be done to the php.ini (ref: http://www.w3schools.com/PHP/php_ref_mail.asp) file to allow this to be done.
Is this possible without installing anything?
If not, What email software do you suggest?
Any help in the configuration of such a feature is greatly appreciated.
That depends on whether or not you want to be able to use firewall host as smtp server.
From what your link says , all you need is smtp server accessible from the machine where the script resides.
Most likely you will need smtp server that allows relaying if you want to send users on various domains.
I am not 100% sure whether php included within pfsense supports that (just try to write a simple php script using mail function).
SpankIt last edited by
Thanks for the quick reply. If I understand your post correctly I can use my ISP's SMTP server for this? (the company I work for is also the ISP). If that's the case then I just add the following line to my php.ini file and I'm good to go?
EDIT: Forgot to mention in my original post. The custom redirect page is being hosted on my pfSense box. According to that page the SMTP setting seems to only be available for a windows machine. Unless they are talking about the client side.
I think you have to set that in php.ini
I believe you can use smtp server address for *nix systems too.
mhab12 last edited by
If you get this to 100% functional, please post a 'how-to' for the group. I (and I'm sure others) would love to add this to my 'error' pages as well. Great idea.
Dipstah last edited by
not sure if this helps But this is what I did to add a mailto: link to my custom block page.
php code found in these forums
$page = $_GET['page'];
$group = $_GET['group'];
/* echo "URL: $page";
echo "Group: $group";
Link for email
If you feel this site has been rated incorrectly, please "<"a href="mailto:email@example.com?subject=Blocked Site &body=This site was blocked and was found in group . "">"click here to submit this link for review.
Redirect Mode = "ext url redirect (enter URL)"
URL you need to add to squidguard config http://ip of pfsense/path to custom page..php?group=%t&page=%u
this doesn't use php's internal mail functions but works for me. When clicked on it opens the users mail program with the subject and body already populated with info.
Ok there is a better option .
Get yourself a php mailer.
http://sourceforge.net/projects/phpmailer/files/phpmailer for php4/
Extract two php files into /etc/inc or any other folder in the include path and use their example :)
Doesn't support smtp auth so won't work with all servers.
2.0 has smtp notifications built in, you might look back at the commit logs and see what was done to make that work.