Failed reCAPTCHA on every attempt to make this code work....

10 views
Skip to first unread message

T Tibbits

unread,
Apr 7, 2016, 9:54:25 AM4/7/16
to Webscript.io
Hi All
I'm not a proficient coder, but have been trying to get a contact form integrated with reCAPTCHA, so far unsuccessfully.

I have checked and checked again the private and public site keys, and am sure they are corrrect.

Here's the domain: www.thelondonbuntingcompany.co.uk/contact.html

Here's teh webscript script:

local USERNAME = 'tom.t...@gmail.com'
local PASSWORD = '$$$$$$$$'
local SERVER = 'smtp.gmail.com'
local RECAPTCHAKEY = '$$$$$$$$'
local recaptcha = require 'recaptcha'
local markdown = require 'markdown'
 
if recaptcha.validate(RECAPTCHAKEY, request) then
    html = markdown(request.form.body)
    email.send {
        server = SERVER, username = USERNAME, password = PASSWORD,
        from = 'tom.t...@gmail.com', to = 'ly...@thelondonbuntingcompany.co.uk',
        subject = '[contact form] '..request.form.subject,
        text = request.form.body,
        replyto = request.form.replyto,
        html = html
    }
    return '<p>Sent the following mail:</p>'
            ..'<p>Subject: '..request.form.subject..'</p>'
            ..html,
        {['Content-Type'] = 'text/html'}
else
    return 'Failed CAPTCHA.'
end

No matter what I do, I get an error of Failed Captcha, and no email. error code is 200.


Any help or explanation of what I'm doing wrong - I would be very grateful :)

Tom
Reply all
Reply to author
Forward
0 new messages