Ajax Contact Form with attachments 2.0


Ajax Contact Form with Attachments and no spam control (drag and drop, reCaptcha, ayah)

The w2 Ajax Contact Form is a complete solution to create ajax contact form. Designed to be a flexible plugin, this item offer classics and originals features. You can easily create your own forms HTML templates and your own themes CSS.

minimum requirements:

  • PHP version 5.x (PHP5 or higher).

No Spam Control (Drag and Drop)

The drag’n’drop No Spam Control is an user friendly alternative to the traditionnal Captcha.
It is not a simple drag’n’drop feature to display the send Button. It is a complete solution for anti spam.

The No Spam Control controls the time between each submission (configurable max/min) and generate some hiddens fields with an encryption key (configurable) when the dragger is dropped. The hidden fields are generated with alphanumeric random and Time (encrypted via encryption key) to ensure that the No Spam Control fields are available only for a limited period (configurable).

This is a really safe and user friendly protection. Then it is easy to customise it with CSS.

There is 4 type for No Spam Control:

  • basic (simply drag’n’drop)
  • colors (drag’n’drop the right color)
  • numbers (drag’n’drop the right number)
  • shapes (drag’n’drop the right shape)

The plugin allows you to use other capctha solution like Google ReCaptcha or AYAH (are you a human).

PHP and JavaScript Librarys

  • This plugin uses some PHP Zend Components (Zend Mail, Zend Mime) for mailling features.

    The Zend Mail component is one of the most powerfull and professionnal mailling library. It allows you to deliver clean mail (encodage and attachments) for all mailbox type (desktop or mobile).
  • It uses classics jQuery plugins like jQuery Ui, jQuery Form, jQuery Validation. All themes (jQuery UI) and translation files for plugins are indluded in the package.

WordPress version available
Videos tutorials


  • Optimized for iDevices (responsive).
  • Multiple or single attachments files (you can easily disable this feature).
  • Multiple or single recipient (simultaneously or not).
  • Easy to configure (html, css, javascript, php).
  • Easy to add (or remove) your own fields.
  • Auto-responder feature (configurable).
  • Javascript and php validation.
  • Email message accepts HTML content (configurable).
  • You can use multiple instance of form in the same page.
  • PHP Script based on the open source Zend Framework Components Mail, Mime and Translate.
  • Drag and Drop feature (no spam control) have 4 differents models (view live preview).
  • Drag and Drop feature (no spam control) is ready for touch screen.
  • ReCaptcha integration.
  • ayah (Are You A Human) integration.
  • Full documentation (examples well documented).
  • JQuery plugin fully configurable:
    //Initialisation of the form
      noSpamControl: true,  //Specifie if No Spam Control is activate (true / false)
      noSpamControlType: 1,  //Spcifie the Type of No Spam Control (1 / 2)
      resetForm: true, //Spcifie if reset form after submit (true / false)
      reCaptchaPublicKey: null, //Specifie your reCaptcha PublicKey
      reCaptchaId: 'recaptcha', //Specifie an unqiue ID for HTML element where reCaptcha will be integrated (just specifie the ID do not create the element in the form)
      reCaptchaTheme: 'clean', //Specifie the reCaptcha theme you want to use
      reCaptchaLang: 'en', //Specifie the reCaptcha Lang you want to use
      reloadCaptcha: true, //Specifie if captcha is reloaded after submit (true / false)
      ayah: false, //Specifie if AYAH is activate (true / false)
      attachmentFile: true,  //Specifie if attachment file is activate (true / false)
      maxAttachments: 5, //Specifie the maximum number of attachments files
      showBtnSend: false, //Specifie if the btn send is visible when loading form when No Spam Control is activate (true / false)
      customFileInput: true, //Specifie if file input is custom skin (true / false)
      submitAlertType: 'slide', //Specifie the type of alert displaying for submit (dialog / slide)
      maxAttAlertType: 'slide', //Specifie the type of alert displaying for maximum attachments (dialog / slide)
      urlLoaderImg: 'css/w2_contact_form/images/ajax-loader.gif', //Specifie the url of the loader image
      nospamInfoHover: true //Specifie if nospam infos is displaying on mouseover (true / false)
  • PHP Class fully configurable:
      //creation of a new instance of Class Contact
      $contact = new W2ContactForm();
      //if you need to redefine some parameters (example: if you have several contact form in your web site)
      //Specifies the emails sender. If you don't specifie email sender the email used to send the mail will be the user mail (who submit the form)
      ///Specifies the emails recipients. You can specifies several emails for multiple recipient. If only one email is specifie the default email will be the first (index 1)
      $contact->setMailRecipient(array('1' => 'youremail@mail.net', '2' => 'youremail2@mail.net'));
      //Specifies if you want to use auto responder feature  
      //Specifies if you want to use an email different that email sender to the auto responder
      //Specifies the name of your web site
      $contact->setSiteName(array('name of web site'));
      //Specifies the required fields for the form validation.
      $contact->setRequiredFields(array('recipient', 'mail', 'subject', 'message'));
      //Specifies the fields for adding them in the mail body message - if you don't specifie field all the fields will be automatically added to the mail body message
      $contact->setBodyMessageFields('<p>E-mail: [mail]</p><p>Version: [version]</p><p>Phone: [phone]</p><p>Date of Birth: [datebirth]</p><p>Country: [country]</p><p>Web site: [website]</p><p>Message: [message]</p>');
      //Specifies the subject of the email if you don't use subject field in your form
      $contact->setMailSubject = 'subject of the message';
      //Specifies the fields need HTML encodage (example: textarea)
      //Specifies if HTML tags is accepted in the email message (for the textarea form element)
      //Specifies if the HTML form is encoded in utf_8
      //Specifies the folder for uploads attachments files in your server
      //Specifies the max file size for the attachments files (in octet)
      //Specifies the maximum number for attachments files
      //Specifies the accepted extensions (.jpg, .png, .pdf ...) for the attachments files
      $contact->setExtFileOk(array('pdf', 'doc', 'docx', 'jpeg', 'jpg', 'png', 'gif'));
      //Specifies if you want to delete files uploaded after email sending
      //Specifies the minimum and the maximum time between submission of the form (in seconds)
      $contact->setAntiSpamTimeControl(array('min' => '5', 'max' => '3600'));
      //Specifies if you want the script configure the CHMOD for "uploads" folder
      //Specifies if you want to use no spam control (drag and drop)
      //Specifies if you want to use recaptcha for validation form
      //Specifies if you want to use AYAH for validation form
      //internationnalization with simple .tmx file (laguages/w2_cf_notifications.tmx)
      //Sending email     
  • Easy to internationalize (just use the translated files or create your own):
    for PHP.

Technical Support

For a quick response send me a private message via my profile.
web agency

enjoy !


  • version 2.0.7:

    • Added HTML5 multiple File field support.
    • Fixed PHP7 error.
  • version 2.0.6:

    • Added timestamp, user IP and URL referer at the footer of the mail message.
    • Added new Google recaptcha.
    • Added xlsx entension for attachment file.
    • fixed attached file notification undefined.
  • version 2.0.5:

    • Fixed wrong auto responder sender name in mailbox.
  • version 2.0.4:

    • Added HTML5 data-attached-notification attribute to display text notification for attachment file button.
  • version 2.0.3:

    • Added feature to add “entry incomplete” notification for javascript validation.
    • Updated CSS themes.
    • Added feature to add field values in mail subject.
  • version 2.0.2:

    • Fixed bug for lang selection.
    • Updated CSS themes.
  • version 2.0.1:

    • Added feature to add cc or bcc recipient by using this synthax “bcc:recipient@mail.net”.
    • Updated CSS grid layout to center the grid elements.
  • version 2.0:

    • Added Ui tootlip support.
    • Added form multi page support
    • Added CSS grid layout to create complex form template responsive.
    • Added HTML5 data-rule validation.
    • Added new jQuery plugin paramater for success submit ( hideFormAfterSubmit, redirectTo, delayRedirect ).
    • Removed inline HTML template ( use grid layout instead )
  • version 1.2.1:

    • Added missing Zend Validate library files for sending mail via smtp.
  • version 1.2.0:

    • Updated the translation process to replace .tmx file by .php files.The goal is to minify the package by removing the Zend translate component.
    • Added new methods to specify the auto-responder message and subject or all PHP notification messages without editing the translation files.
    • Added new responsive CSS rules for nospam message box
  • version 1.1.18:

    • Updated CSS files to center fields elements.
  • version 1.1.17:

    • Added a new method to send email to all recipients automatically (without using hidden fields).
  • version 1.1.16:

    • Added translation files for datepicker widget
  • version 1.1.15:

    • Added CSS transition for IE 10
  • version 1.1.14:

    • Fix bug for placeholder on IE9.
  • version 1.1.13:

    • New method to only upload files (not send them as attachment).
  • version 1.1.12:

    • New feature to add attachment files to the auto-responder message.
  • version 1.1.11:

    • Add loader for nospam control to display button “send” only when nospam hidden fields are completely loaded (usefull for slow server connexion).
  • version 1.1.10:

    • Fix CSS bug for custom file input in IE10.
  • version 1.1.9:

    • Adding new laguage (Portuguese).
  • version 1.1.8:

    • Possibility to add fields value in the auto-responder message (just use shortcode [field_name] in the content of the mail responder message).
    • New HTML form template with HTML5 attribute placeholder.
  • version 1.1.7:

    • upgraded the PHP AYAH library to fix error
  • version 1.1.6:

    • Progress bar for attachment file upload
    • Fix error for jquery 1.9 ($.browser).
    • Adding the HTML attributes enctype=”multipart/form-data” for form element in examples.
  • version 1.1.5:

    • CSS transition now available for browser Chrome, Safari and Opera.
  • version 1.1.4:
    • Automatic reloading of AYAH after form submission.
    • Fix CSS bug for button send color with CSS theme hot-sneaks.
  • version 1.1.3:
    • Fix PHP 5.4 error for $_FILES.
    • Fix CSS bug for UI button set on Chrome.
    • Jquery UI 1.9.2 included in download package (if you need to use it).
    • Body mail message display breakline (for Textarea fields value).
  • version 1.1.2:
    • Fix bug for checkbox fields width in Chrome.
    • You can add your own custom file field in your form.
  • version 1.1.1:
    • You can send your email via SMTP with authentification (example: gmail).
    • New method to create your own HTML template for the mail body message.
    • New javascript callback for submit success event. You can create your own javascript function for submit success event.
  • version 1.1.0:
    • You can send your email via SMTP.
    • Fix encodage bug for utf_8 content in the mail message to accept all type of character.
    • new CSS style (resizable) optimized for iDevices.
    • fix error message for missing language translation.
    • javascript callback function (beforeSubmit) to create your own specific rules of validation.
    • code source form editor (included in download package).
    • easy insatallation package (all files in one folder).
    • new CSS UI themes (for UI widget datepicker, buttonset …).
    • auto-responder feature.
    • easy translation method for PHP notifications messages (via .tmx file).
    • ayah (Are You A Human) integration.


Leave a Reply

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