jonmbake / bootstrap3-contact-form

Bootstrap 3 Contact Form with Captcha
MIT License
169 stars 84 forks source link

after i click on submit i getting reCAPTCHA checked failed! #5

Closed JarbyDev closed 9 years ago

JarbyDev commented 9 years ago

Hello

after i clicked on on submit i getting the following message reCAPTCHA checked failed!

jonmbake commented 9 years ago

Hey Thomas. Does it work if you remove the reCAPTCHA check in sendmail.php?

JarbyDev commented 9 years ago

The only part i found on sendmail.php is
if (!$result->success) { errorResponse('reCAPTCHA checked failed!'); }

but i would like use recaptcha,

jonmbake commented 9 years ago

Are you sure that the environment variables are being passed in correctly? Have you tried replacing the ENV calls in sendmail.php with the static values like in this gist: https://gist.github.com/jonmbake/0e5b175a72ad9ba64167? The other thing that it could be is a firewall issue on your server.

JarbyDev commented 9 years ago

i even tried that copy and paste that, but i get the following code An expected error occured while attempting to send the email: SMTP connect() failed. and sometimes stuck on sending...

I tried the form on Godaddy Server and also on a Server on Amazon AWS,

jonmbake commented 9 years ago

That's progress! It passed the CAPTCHA check, but failed while attempting to send the email. Can you confirm that your email configuration values are correct? You can print more debugging information by adding $mail->SMTPDebug = 2; after line 50 in sendmail.php. Can you check the server error log to see what got logged?

JarbyDev commented 9 years ago

I added that, but is not generating a error log, stuck on sending, i using a gmail account belong to me,

image

jonmbake commented 9 years ago

Did you look at the server log. Anyway, the issue has to be caused by one of three things: 1) A server firewall is blocking the outgoing mail port. This is unlikely since you tried it on multiple hosting providers and I don't think most block standard outgoing mail ports by default. 2) Your email configurations in sendmail.php are wrong. 3) Gmail is preventing the sending of email from an external app due to some configuration value.

Maybe you can send your sendmail.php (with username/password removed) to me and I can try it with my gmail account to see it works. The demo instance still seems to working and that is sending to my gmail account.

JarbyDev commented 9 years ago

Hello, my friend the code is at https://gist.github.com/thomas1216/a7e64ff0b44baad8cf1e

i even try to use the outgoing mail server, and username and password from an godaddy email account, but dont work either.

Also will be nice use this option available https://support.google.com/a/answer/176600?hl=en

or use a php function to email with no authentication or email settings.

Thanks for all you help

jonmbake commented 9 years ago

Hi Thomas. I verified this worked on my DigitalOcean instance with my gmail account. I did have to change the require statement to require './vender/php_mailer/PHPMailerAutoload.php';. Can you verify PHPMailerAutoload.php is located at ../vendor/php_mailer/PHPMailerAutoload.php on your server? I really recommend checking the server log; it should tell you exactly what the issue is.

For example, to debug the issue with PHPMailerAutoload.php not being present I did:

 > tail /var/log/apache2/error.log
[Sun Sep 20 22:07:28.010518 2015] [:error] PHP Fatal error:  require(): Failed opening required './vendor/php_mailer/PHPMailerAutoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in ~/library/sendmail.php on line 49, referer: https://jonbake.com/demos/contact-form/index.html

Which quickly told me what my problem was. You can also check out this Stack Overflow post, which might be helpful: http://stackoverflow.com/questions/27585936/phpmailer-not-working-with-gmail

JimMichels commented 9 years ago

I had a similar problem and solved this issue by creating a new Google APP password: https://security.google.com/settings/security/apppasswords.