title: Joomla, Sp Page Builder and ReCaptcha
body: <p>It's the First time that I use <strong>SP Page Builder</strong> component with Joomla. I want to use their contact form, but it doesn't support Google ReCaptcha.
  I'm good enough with coding to thought that I could manually add it into : /com_sppagebuilder/addons/ajax_contact/site.php and get it to work.
  I did add : <code>&lt;div class="g-recaptcha" data-sitekey="My_Key"&gt;&lt;/div&gt;;</code>
  And the Joomla ReCaptcha plugin is activated.
  I didn't know if I had to, but I added <code>&lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;</code> into the head tag.
  With this the ReCaptcha is showing fine.</p>
  
  <p>My problem is with the validation.
  I did try to add some validation code in the <strong>site.php</strong> but I believe SP Page Builder uses JFactory::getMailer(); to get the email ready and send it, and I don't know anything about that.</p>
  
  <p>Thus, I do not know where I can add my ReCaptcha validation code, and as I did find few versions of that code online, I really don't know which one to use.
  I've been searching everywhere for some answers to how to do this verification... and I tried many things, but it's still not working.</p>
  
  <p>Can anyone help me through this one ?</p>
  
  <p>Thank you very much !</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I think my question is not clear enough :</p>
  
  <p>I want to add Recaptcha, that is already working fine in other forms on my website (so it's not a configuration with Joomla problem). I want to use the following SP Page Builder contact form and not a RSFormPro as on the rest of the Website. The validation process should be done around this section, but I tried to add the Google validation code, and I tried a few versions of it I found around the Internet, and it's not working at all :</p>
  
  <pre><code>public static function getAjax() {
      $input = JFactory::getApplication()-&gt;input;
      $mail = JFactory::getMailer();
  
      //inputs
      $inputs             = $input-&gt;get('data', array(), 'ARRAY');
  
      foreach ($inputs as $input) {
  
          if( $input['name'] == 'recipient' ) {
              $recipient          = base64_decode($input['value']);
          }
  
          if( $input['name'] == 'email' ) {
              $email          = $input['value'];
          }
  
          if( $input['name'] == 'name' ) {
              $name           = $input['value'];
          }
  
          if( $input['name'] == 'subject' ) {
              $subject            = $input['value'];
          }
  
          if( $input['name'] == 'message' ) {
              $message            = nl2br( $input['value'] );
          }
      }
  
      /*Try at the validation*/
      $captcha_plugin = JFactory::getConfig()-&gt;get('captcha');
      if ($captcha_plugin != '0') {
      $captcha = JCaptcha::getInstance($captcha_plugin);
      $field_id = 'google-recaptcha';
       print $captcha-&gt;display($field_id, $field_id, 'g-recaptcha');
      }
  
  
      $sender = array($email, $name);
      $mail-&gt;setSender($sender);
      $mail-&gt;addRecipient($recipient);
      $mail-&gt;setSubject($subject);
      $mail-&gt;isHTML(true);
      $mail-&gt;Encoding = 'base64';
      $mail-&gt;setBody($message);
  
      if ($mail-&gt;Send()) {
          return '&lt;span class="sppb-text-success"&gt;'. JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SUCCESS') .'&lt;/span&gt;';
      } else {
          return '&lt;span class="sppb-text-danger"&gt;'. JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_FAILED') .'&lt;/span&gt;';
      }
  }
  </code></pre>
  
  <p>Any suggestions ?</p>
  
  <p>Thank you !</p>