When sending an email through the Form plugin, an exception is called by Twig. The error is as follows:
Whoops\Exception\ErrorException thrown with message "Call to a member function header() on a non-object"
Stacktrace:
#0 in C:\Bitnami\wampstack-5.5.28-0\apps\grav\htdocs\user\plugins\login\logi n.php:112
This happens when I submit the following through the form generated by the Form plugin (with the Email plugin enabled, running sendmail through localhost SMTP). The form page looks as follows:
title: A page with a form
form:
name: contactform
fields:
- name: name
label: Name
placeholder: Enter your name
autofocus: on
autocomplete: on
type: text
validate:
required: true
- name: email
label: Email
placeholder: Enter your email address
type: text
validate:
rule: email
required: true
- name: message
label: Message
placeholder: Enter your message
type: textarea
validate:
required: true
buttons:
- type: submit
value: Submit
- type: reset
value: Reset
process:
- email:
subject: "[Grav Contact] {{ form.value.name|e }}"
body: "{% include 'forms/data.html.twig' %}"
- save:
fileprefix: contact-
dateformat: d-m-Y-H-i-s-u
extension: txt
body: "{% include 'forms/data.txt.twig' %}"
- message: Thank you for getting in touch!
- display: thankyou
And I sent the following to test: “Name: Jesus Christ, Email: Mary.Chain@holymail.com, Message: A page with another form.” That is, the mail is clearly sent as it is caught by the Fake SMTP Server, but the page redirects to the error when submitting.
Any thoughts on why this occurs, and how to fix it?