Email setup with reCAPTCHA

I’ve set up reCAPTCHA Contact plugin to the point that I can see a contact page, am able to input a name, and email, and a message, and click submit but I’m wondering whereto configure how the actual email gets sent, and to what address.

Hi, I took a look. I think it’s all explained in the plugin README file

Thanks for the confirmation. I believe I was getting hung up when formatting my own users/languages/languages.yaml. In the default languages.yaml each ID’d by an abbreviation, like en:, es:, and it:.

So, the top of your custom language code should look like this:

RECAPTCHACONTACT:
    FORM_LEGEND: "Contact me"

And not:

en:
  RECAPTCHACONTACT:
    FORM_LEGEND: "Contact me"

I also named my custom languages file. So, basically: users/languages/en.yaml. Also, default language in user/config/plugins/recaptchacontact.yaml is set to default_lang: en.

I’m trying to configure this plugin, so far unsuccessfully. In the readme.md files says:

“For the reCAPTCHA to work you have to copy recaptchacontact.yaml in your /user/config/plugins folder and set your keys.”

So should it copy that file to /user/config/plugins, so it becomes ‘/user/config/plugins/recaptchacontact.yaml’ ? i still have the JS error:

recaptcha__en.js:113 Uncaught Error: Missing required parameters in RecaptchaOptions: sitekey

Or sould i copy to ‘/user/config/recaptchacontact.yaml’ ? The same error

Tried also to copy the string to the .md file with the configs of the form. Same thing

Any ideas?

you copy user/plugins/recaptchacontact/recaptchacontact.yaml to user/config/plugins/recaptchacontact.yaml. You then edit (and add the key to) the file in user/config/plugins. That way, when the plugin gets updated, your config doesn’t get overwritten.

mhh, now ihave it configured to the domain, i’m having issues with permissions on the server. lomorrow i’ll try again. Thanks for the nice info :slight_smile:

Hello again. Seems i jumped of the hot pot, to the frying pan. I now have the error

Argument 1 passed to Grav\Plugin\EmailPlugin::buildMessage() must be of the type array, null given, called in /home/pixyznet/public_html/user/plugins/email/email.php on line 75 and defined

this email.php is suposed to recieve the parameters to build the email. So, my debug is:

public function onFormProcessed(Event $event) {
  dump($event);
  die();

I can see its getting the info:

Event {#137
#items: array:3 [▼
"form" => Form {#154
+message: null
+message_color: null
#header_data: []
#rules: []
#data: Data {#157
#gettersVariable: “items”
#items: array:4 [▼
"name" => “Luis”
“email” => "email@gmail.com"
“telefone” => "912123123"
“maisinfo” => “test”

So, in

    $form = $event['form'];
    $action = $event['action'];
    $params = $event['params'];

    dump($params);
    die();

so th index “params” doesn’t exist, but the info is there. So what can i do?

thanks for any help

Ah, btw: the site is in http://pixyz.net/

What do your email.yaml and recaptchacontact.yaml files look like? (Sanitized of sensitive information, of course.)

/user/config/recaptchacontact/recaptchacontact.yaml

enabled: true
default_lang: pt
disable_css: false
inject_template: true
grecaptcha_sitekey: "[grecaptcha_sitekey_string]"
grecaptcha_secret: “[grecaptcha_secret_string]”

(replace grecaptcha_secret_string and grecaptcha_sitekey_string by true keys)

and email.yaml?? i don’t have that. can’t find info about it. Can u plz show where to get it and how to configure it?

thanks

I’m just confused because your error messages are referencing the Email plugin, which Recaptchacontact doesn’t rely on. When I go to your website’s contact page, I don’t see the recaptcha field. And when I try to send, the error message is for the Email plugin.

Sorry for the late repply. Yes, i did uninstall captcha (i’m also sorry not to mention this :frowning: ), just to see if the email worked without it. But its seems the email plugin has some misconfiguration.

I folowed the reademe file, and with the info in https://support.google.com/a/answer/176600?hl=en
i configured the email as such:

enabled: true
from: [email]
from_name: pixyz.net
to: [email]
to_name: [email]
mailer:
engine: mail
smtp:
server: smtp.gmail.com
port: 465
encryption: ssl
user: '[email]'
password: '[password]'
sendmail:
bin: '/usr/sbin/sendmail’
content_type: text/html
debug: true

But i still have:

Argument 1 passed to Grav\Plugin\EmailPlugin::buildMessage() must be of the type array, null given, called in /home/pixyznet/public_html/user/plugins/email/email.php on line 74 and defined

I noticed $params gets a null value, in

public function onFormProcessed(Event $event) {
    $form = $event['form'];
    $action = $event['action'];
    $params = $event['params'];
    var_dump($params);
    die();

i do know $action is valid:

var_dump($action); // string(5) “email”

this $params is probably the cause for complain, once it is the 2nd parameter in

$message = $this->buildMessage($params, $vars);

tomorrow i’ll try to look at this again. Anyone wants to take a shot?

Thank u all for the paitience. Cheers :slight_smile: