Email Form PHP and jQuery script featured

2 Simplest Scripts For Your Web Contact Forms To Send You Email

Views: 478

Hundred of times I have seen designers or people who have built their websites in HTML keep looking for ways to make a contact form work, so I decided to create a simple PHP script which is usable by anyone who even doesn’t know how to code and make their contact forms and other forms work like a charm using Ajax.

For this form email script to work we need a PHP server with SMTP (Simple Mail Transfer Protocol) enabled and configured properly and jQuery.

So now I will describe the configuration process for this mail script.

Download jQuery and add to your page.

  1. Download jQuery if it is not already added to your HTML page where you want to use this script, add the jQuery script to your webpage.
  2. Add this mailer.js script to your web page.
  3. Configure the JS and PHP form mailer files with appropriate details of your contact or any other form.

Download And Embed jQuery

For downloading jQuery visit the following URL

jQuery Download

Once jQuery is downloaded and added to your web page, download this PHP email form script, extract and add the JavaScript file to your web page too.

If you find any difficulty embedding this PHP and jQuery mail script with your contact form or any other forms, refer to the index.php sample file.

Here Are 2 Simplest Scripts And Other Files For Your Web Contact Forms To Send You Email

Download Form Mailer Script Files

PHP Contact Form Email Script

Configuring the JS file

Open mailer.js with any text editor, set the value of form variable to ID/ class of your contact form. See the example below.

My contact form is:

<form method="post" action="sendmail.php" id="mailform">

My script settings:

form=’#mailform’;

on line 4 of mailer.js

Note:

If you want to use class name as selector then:

Suppose form’s class name is “contactform”, set value of the form variable to .contactform

If you want to use form’s ID as selector then:

Suppose form ID is “mailform”, set value of the form variable to #mailform.

Check the AJAX URL value, make sure the PHP file resides in the exact address, else AJAX will fail to request the PHP script for sending mail.

Configuring the PHP form mailer file

Open the PHP  mailer file with notepad or any of your text editor, set values for all desired fields:

$exclude: This variable is to filter out all the fields of contact form that you do not want to be included in mail.

$message: You can add additional text to the emails sent here.

$from: This will set a from header to the email sent, use [email protected]_domain.com as the address.

$subject: The subject of email to be sent.

$to: The address on which form as mail will be sent.

 

Advance Configurations For The PHP Form Mail Script:

If you need more features in this script or help implementing the script, you can reach me via the contact section in this website.

For any other requirements contact me whenever necessary.

If you want more scripts coming for free on this website, you may help me by donating a little fund from your pocket, which will help me get more scripts for you. And keep this website hosted. Click the button below to donate me on paypal.

Donate

Comments: 0

Your email address will not be published. Required fields are marked with *