jcadima
6/20/2017 - 2:44 PM

Magento Recaptcha setup

Magento Recaptcha setup

Gmail SMTP server address: smtp.gmail.com
Gmail SMTP username: Your full Gmail address (e.g. yourusername@gmail.com)
Gmail SMTP password: Your Gmail password
Gmail SMTP port (TLS): 587
Gmail SMTP port (SSL): 465
Gmail SMTP TLS/SSL required: yes

for magento recaptcha :
put the following files in the webroot:
  config.php
  send_email.php
  class.smtp.php
  class.phpmailer.php
  PHPMailerAutoload.php
  Recaptcha.php


JS should be like:

<script>
jQuery(document).ready(function() {
	jQuery("#contactForm").submit(function(event) {
		jQuery('#loader').show() ;

	    event.preventDefault();

	    var g_recaptcha_response  = jQuery('#g-recaptcha-response').val();
		//var currenturl = jQuery('#currenturl').val();
		var values = jQuery(this).serialize();

	    // Clear result div
	    jQuery("#result").html('');
	    
        ajaxRequest = jQuery.ajax({
            url: "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>send_email.php",
            type: "post",
            data: values
        });


        ajaxRequest.done(function (response, textStatus, jqXHR){
          // show successfully for submit message
          console.log("SUCCESS") ;
          jQuery('#result').show() ;
          jQuery("#result").html(response);
          jQuery('#loader').hide() ;
          /*
          setTimeout(function () {
		  	window.location.href=currenturl; // the redirect goes here
		  		
		  },3000); // 3 seconds  
		  */          
        });


        ajaxRequest.fail(function (response){
        // show error
        console.log(" ajax fail ERROR" + response) ;
        jQuery("#result").html('Error found trying to submit the form: ' + response );
        });

	});


});

</script>