Smtp validating form
To be able to receive the emails, you will need to upload the script to your webhost. As always, there could be further modifications done as e.g. I have created a tutorial covering this topic: check out Bootstrap & Re Captcha form tutorial.If you haven't done that already, have a look at my free Bootstrap themes too.There is a PHPMailer package included in the download but I suggest that you download the actual release from its Git Hub.Apart from including PHPMailer autoload file, we will need to make few changes to our configuration part of the PHP script.Please try again later'; /* * LET'S DO THE SENDING */ // if you are not debugging and don't need error reporting, turn this off by error_reporting(0); error_reporting(E_ALL & ~E_NOTICE); try catch (\Exception $e) // if requested by AJAX request return JSON response if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') // else just display the message else Local testing and usage: If you are testing the contact form on your computer, the PHP script and whole process should work but you will not receive the email to your inbox. You should have a great contact form working and ready to be implemented on your website.
The solution to this would be following: // if requested by AJAX request return JSON response if (! The localhost solution, be it XAMPP or similar, will most probably not have any working mail server included.I will not go to the details too much though, as styling emails is a whole new chapter.Maybe you will not need the AJAX form submit in the background but you would welcome a possibility to redirect the user to a different page.As the last thing, you will learn how little Java Script magic (we will use j Query) is needed to submit the form via AJAX without reloading the page itself.
This will be really handy when you have the contact form on the one-page web and you don't want to reload the whole page.
There should not be anything tricky for you, so just a few words about it: 'Message'); // message that will be displayed when everything is OK :) $ok Message = 'Contact form successfully submitted. '; // If something goes wrong, we will display this message.