Issues with eMail processing on modular forms

form

#1

Hi,

I make multiple use of the form-plugin within a modular page.
The page consits of a modular sub-pages of special offers and every offer has a form attached which is somehow different to the other offer-forms on this page. (Basically some values is a selectbox are different)

Besides this offer-forms there is a contact-form in the footer of this page too, which uses the same eMail-plugin config and within this footer-form everything works fine.
But within the modular-page-form eMail-processing doesn´t work and also all the following processing steps (and logging) are not executed. But when the email-processing part ist commented out all the other steps (save, redirect, reset) work fine: Form gets saved and the browser redirects.

I include the form with
{% include "forms/form.html.twig" with { form: page.header.form } %}
in the modular-template, which makes use of the form-twigs that are provided by the form-plugin itself. All the needed hidden fields are there:

  • form-name
  • unique_form_id
  • form-nonce

Both, the footer-form and my modular-sub-page-forms have the exact same processing configuration.

The modular-sub-page-form has

cache_enable: false

and

form.action: /route-to-modular-page

set in addition and other fields.

eMail-plugin-conf is set with SMTP/SSL and this config works fine for the footer-form.

additionally i tried with

debug: true
errors:
  display: 1                                    
  log: true

but nothing gets written to the logs too.
Also logging is fine for the footer-form.

Any Ideas and advice how to furhter track down this issue?

Thanks
–mirac


#2

can you post your form definition?

also, make sure everything is correct with your email setting by typing this command:
bin/plugin email test-email -t steve@apple.com


#3

sure (with some german ;-)):

title: Winterzauber
template: modular/arrangement
unpublish_date: 04-03-2018
cache_enable: false

form:
  name: Winterzauber
  classes: "row 50%"
  action: '/angebote'
  fields:
    - name: Anrede
      label: Anrede
      placeholder: Anrede
      type: select
      options:
        Frau: Frau
        Herr: Herr
      outerclasses: "3u 12u(mobilep)"
      validate:
        required: true

    - name: Name
      label: Name
      placeholder: Vor-/Nachname
      type: text
      outerclasses: "9u 12u(mobilep)"
      validate:
        required: true

    - name: eMail
      label: eMail
      placeholder: eMail
      type: email
      outerclasses: "12u"
      validate:
        rule: email
        required: true
        
    - name: Option
      label: Option
      type: select
      options:
        DPL-See-138: '€ 138,- pro Person im Doppelzimmer zum See gelegen'
        EZL-158: '€ 158,- im Einzelzimmer'
      outerclasses: "12u"
      validate:
        required: true

    - name: Ankunft
      label: 'Anreise'
      placeholder: 'Anreise (TT.MM.JJJJ)'
      type: text
      #  type: date not support by all browser: TODO: find clever fallback
      outerclasses: "6u 12u(mobilep)"
      validate:
        required: true

  buttons:
      - type: submit
        value: "Anfrage abschicken"
      - type: reset
        value: "zurück setzen"
        classes: "alt"

  process:
    - email:
        from: "{{ form.value.eMail|e }}"
        to: "{{ config.plugins.email.booking_mail|e }}" #this additional value is set in email.yaml
        subject: "[Buchungsanfrage:] {{ form.value.Name|e }}"
        body: "{% include 'forms/data.html.twig' %}"
    - save:
        fileprefix: Winterzauber-
        dateformat: Ymd-His-u
        extension: html
        body: "{% include 'forms/data.html.twig' %}"
    - redirect: '/danke'
    - reset: true

I tried also with static process[email.values] with no success.


#4

bin/plugin email test-email -t xxx@gmail.com

[...]
Message sent successfully!

works fine!

[EDIT]
the test-email also sends the SMTP/SSL credentials, which is somehow… puh :wink:


#5

I figured it out.
I had an 301 redirect in site.yaml set to that action-route.
And that turned the POST into an GET.