Home › Forums › Porto Template › reCaptcha in contact form
- This topic has 9 replies, 2 voices, and was last updated 2 weeks, 6 days ago by
Support2. This post has been viewed 158 times
-
AuthorPosts
-
November 13, 2019 at 3:32 am #10031218
surfersteve
ParticipantHi,
I’ve attempted to add a google v2 Recaptcha to this website, but it doesn’t seem to be working as the Recaptcha is ignored.
I’ve done the things stated in the ‘Google Recaptcha v2’ link within the HTML document that came with the theme and that didn’t work so I followed the instructions on this forum post that I found link
Any help would be much appreciated.
Thanks,
Steve
November 13, 2019 at 6:18 am #10031220Support2
KeymasterHello Steve,
The HTML structure and JS into your front-end it’s all correct.
We need check your server side file
php/contact-form.php
. Please share all code of this with us. You can use a service like https://pastebin.com to generate a link with the code for us (change to “XXXX” where has credentials like password/secret keys)Kind Regards,
Rodrigo.
November 13, 2019 at 6:45 am #10031222surfersteve
ParticipantThis reply has been marked as private.November 13, 2019 at 11:12 pm #10031225Support2
KeymasterHello Steve,
The code in your
contact-form.php
also seems to be all correct.This is a strange issue, since the
contact-form.php
it’s returningsuccess
even with empty$_POST['recaptcha']
.In that case we will need a temporary access to your server files trough FTP, can you please create a temporary access for us ? We will need host, username and password. In that way we can do some tests and discover where is the issue.
Kind Regards,
Rodrigo.
November 14, 2019 at 3:16 am #10031229surfersteve
ParticipantThis reply has been marked as private.November 14, 2019 at 6:42 am #10031232Support2
KeymasterThis reply has been marked as private.November 14, 2019 at 7:16 am #10031233surfersteve
ParticipantThis reply has been marked as private.November 14, 2019 at 11:38 pm #10031234Support2
KeymasterHello Steve,
No problem! 🙂
Regarding the new error: It’s missing the HTML code that shows the message errors from recaptcha:
<div class="alert alert-danger d-none" id="contactError"> <strong>Error!</strong> There was an error sending your message. <span class="mail-error-message text-1 d-block" id="mailErrorMessage"></span> </div>
* I already added this HTML code to your index.html trough the FTP.
Note that now returns
Please click on the reCaptcha box
when user try to send without check the recaptcha.When we check the recaptcha and try to send email it’s returning
Could not instantiate mail() function
. This means that your server don’t have the PHPmail()
function enabled. In that case you need contact your hosting provider to enable this OR use SMTP to send emails. I suggest to your the SMTP method.To use the SMTP method just uncomment the “Step 2” on the
contact-form.php
file:// Step 2 (Optional) - If you don't receive the email, try to configure the parameters below: $mail->IsSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.yourserver.com'; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'user@example.com'; // SMTP username $mail->Password = 'secret'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted $mail->Port = 587; // TCP port to connect to
* Get the correct SMTP settings values with your hosting provider.
Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
November 15, 2019 at 9:41 pm #10031242surfersteve
ParticipantHi Rodrigo,
I setup SMTP and it’s now working perfectly.
Thanks again for your help and once again sorry about the php/contact-form.php not being synchronised!
Steve
November 16, 2019 at 11:49 am #10031247Support2
KeymasterHello Steve,
Great!
Don´t worrie about php/contact-form.php sync.
Kind Regards,
Rodrigo.
-
AuthorPosts