getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
354 stars 227 forks source link

Form with email sending is not working #1251

Closed simi2 closed 6 years ago

simi2 commented 6 years ago

Hi,

I am new to grav. I am using Agency theme with skeleton.

I have set form with tutorial for modular page, but I see an error:

"TypeError Argument 1 passed to Grav\Plugin\EmailPlugin::buildMessage() must be of the type array, null given, called in /storage/ssd4/315/2049315/public_html/user/plugins/email/email.php on line 75"

Here is my configuration of modular.md:

`form: name: contact action: /home

fields:
    - name: name
      label: Name
      classes: form-control
      placeholder: Enter your name
      autofocus: off
      autocomplete: on
      type: text
      position: left
      validate:
        required: true

    - name: email
      label: Email
      classes: form-control
      placeholder: Enter your email address
      type: email
      position: left
      validate:
        required: true

    - name: message
      label: Message
      placeholder: Enter your message
      type: textarea
      classes: form-control
      position: right
      validate:
        required: true

buttons:
    - type: submit
      classes: "btn btn-primary btn-lg"
      value: Submit

process:
  - email:
    subject: "Message"
    body: "{{form.value.message|e}}"
    from: "{{form.value.email|e}}"
    from_name: "{{form.value.email|e}}"
    to: myaddress
    to_name: 'Custom recipient name'
  - message: Thank you for getting in touch!`

I been trying hard, but can´t find out solution.

rhukster commented 6 years ago

actually if that indention is accurate (hard to tell because its a bit of a botched paste), then your indentation of the process section is incorrect:

should be more like this:

process:
  - 
    email:
        subject: "Message"
        body: "{{form.value.message|e}}"
        from: "{{form.value.email|e}}"
        from_name: "{{form.value.email|e}}"
        to: myaddress
        to_name: 'Custom recipient name'
  - 
    message: Thank you for getting in touch!`
simi2 commented 6 years ago

I found on internet that this issue is in Agency theme. I am for now using formspree.io.

Thanks for help.