getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

No $params being send to email.php? #51

Closed bobrocke closed 7 years ago

bobrocke commented 7 years ago

I have a form configured to send email via SMTP:

my email.yaml:

enabled: true
from: bob@bobrockefeller.com
from_name: Bob Rockefeller
mailer:
  engine: smtp
  smtp:
    server: minutemen.reclaimhosting.com
    port: 465
    encryption: SSL
    user: 'XXXXX'
    password: 'XXXXX'
  sendmail:
    bin: '/usr/sbin/sendmail'
content_type: text/html
debug: false

My form blueprint:

form:
  name: contact-form
  method: POST

  fields:
    - name: name
      label: Name:
      autofocus: on
      autocomplete: on
      type: text
      validate:
        required: true
      outerclasses: contact-form-name

    - name: email
      label: Email:
      type: email
      validate:
        required: true
      outerclasses: contact-form-email

    - name: message
      label: Message:
      type: textarea
      validate:
        required: true
      outerclasses: contact-form-body

    - name: honeypot
      type: honeypot

  buttons:
    - type: submit
      value: Submit
      classes: contact-form-button
    - type: reset
      value: Reset
      classes: contact-form-button

  process:
    - email:
      subject: Contact from BR.com
      to: photos@bobrockefeller.com
      to_name: Bob Rockefeller
      from: "{{form.value.email|e}}"
      from_name: "{{form.value.name|e}}"
      body: "{{form.value.message|e}}"

When the form processes and attempts to send the email, I get this error:

Server Error
Sorry, something went terribly wrong!

0 - Argument 1 passed to Grav\Plugin\EmailPlugin::buildMessage() must be of the type array, null given, called in /Users/bob/Dropbox/SyncedSites/vhosts/www.br.dev/user/plugins/email/email.php on line 74

So I have something screwed up somewhere. But what?

flaviocopes commented 7 years ago

Looks like the email action parameters are not found.

I don't see anything strange form watching. Make sure indenting is ok (spaces / tabs). Maybe try using 4 spaces instead of 2 in the process action definition.

bobrocke commented 7 years ago

I've double-checked and the indenting seems OK - it's 2 spaces everywhere in the front-matter.

Is there something I can do to dig into troubleshooting?

flaviocopes commented 7 years ago

PM me on Slack your user/ folder so I can try replicating with your exact same setup

bobrocke commented 7 years ago

Thanks! I sent it.

bobrocke commented 7 years ago

Flavio found the problem. It was an older version of Forms that just needed to be updated.