Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Email setup with reCAPTCHA

Started by Muut Archive 11 years ago · 10 replies · 1281 views
11 years ago

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.

11 years ago

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

11 years ago

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:

YAML
RECAPTCHACONTACT:
    FORM_LEGEND: "Contact me"

And not:

YAML
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.

10 years ago

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?

10 years ago

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.

10 years ago

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 :)

10 years ago

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:

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

I can see its getting the info:

Event {#137 ▼

items: array:3 [▼

JS
"form" => Form {#154  +message: null
  +message_color: null
  #header_data: []
  #rules: []
  #data: Data {#157    #gettersVariable: "items"
    #items: array:4 [      "name" => "Luis"
      "email" => "[email protected]"
      "telefone" => "912123123"
      "maisinfo" => "test"

So, in

PHP
    $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/

10 years ago

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

10 years ago

/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

10 years ago

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.

10 years ago

Sorry for the late repply. Yes, i did uninstall captcha (i'm also sorry not to mention this :( ), 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

PHP
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 :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2959 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago