PHP Email Contact Form

Bootstrap Contact Form

If you one of those guys struggling to get the PHP Mail to work like it should, take a look at this form. I have used a PHP/HTML Form and perl to send the actual mail. I couldn’t get the php mail to work, no matter what I did to the php.ini. I had no issues sending mail from the command line, just not from a php file. I decided to use perl to send the actual mail which worked just fine, although I shouldn’t have had to go to perl to send the mail. I personally think the PHP Mail implementation is seriously broken.

I got the original form here, by Pavel Malos, it’s worth checking it out as it may work for you. I like the look of the form with the curved boxes vs the general boring boxes.


You going to need the following to make this work

Contact Form

What the final contact form will look like, you can play around with the background colour.

Image of What the form box looks like


This is the final PHP/HTML code that displays the form, make sure you grab the css file as well or use the link below in your code and don’t forget to get the You can see this form in action at


This is my mail.cgi I pulled from my scripts and you can test it from the command line by running perl mail.cgi and it should run with no errors.



This is an old but reliable cgi library, I searched and doesn’t seem to be readily available on the internet. There are probably some other libraries you can use instead that are more modern, but I have been using this one for over 10 years and know it works and is solid.


Please go ahead and comment

I would love to hear from you and if I have missed anything, let me know and I will add it.


You might also want to take a look at my review of creating a Personal Webserver on AWS Cloud.

About the Author Steven

Steven has a technical background in System Design, Unix Systems and Enterprise Architecture & Design. He also has a background with 15 years of Unix Systems Primarily HP-UX, Linux and AIX Open Systems. He also has a background in programming languages such as C, Perl, PHP, CGI and Web Environments.

follow me on:

Leave a Comment:

PHP Use the Amazon API to Get Product Prices - Geeky Frog says November 16, 2017

[…] may also be interested in the Email Form […]

PHP - Infinite Scroll Pagination using JQuery Ajax Example - Geeky Frog says November 18, 2017

[…] may also be interested in the Amazon API Post or the PHP Email […]

Add Your Reply