getgrav / grav-plugin-email

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

email will not be sent when caching is enabled #145

Closed danielkoptak closed 1 year ago

danielkoptak commented 3 years ago

Hi, when the cache is enabled: Configuration -> system - caching -> caching - > yes then the email will not be sent, even though I have the cache turned off in expert mode. My page:

title: Contact
never_cache_twig: true
hide_git_sync_repo_link: false
cache_enable: false
form:
    name: contact-expats-en
    classes: contact-form
    template: form-messages
    fields:
        name:
            label: Name
            id: contact_Name
            autocomplete: 'on'
            type: text
            validate:
                required: true
        surname:
            label: Surname
            id: contact_Surname
            autocomplete: 'on'
            type: text
            validate:
                required: true
        email:
            label: E-mail
            id: contact_Email
            autocomplete: 'on'
            type: email
            validate:
                required: true
        send:
            label: 'Select the country that the query applies to'
            id: contact_Select
            autocomplete: 'on'
            type: select
            default: expats@neotax.eu
            options:
                expats+austria@neotax.eu: Austria
                expats+belgium@neotax.eu: Belgium
                expats+canada@neotax.eu: Canada
                podpora@neotax.cz: 'Czech Republic'
                expats+germany@neotax.eu: Germany
                expats+italy@neotax.eu: Italy
                expats+luxembourg@neotax.eu: Luxembourg
                expats+netherlands@neotax.eu: Netherlands
                expats+poland@neotax.eu: Poland
                podpora@neotax.sk: Slovakia
                expats+unitedkingdom@neotax.eu: 'United Kingdom'
                expats+usa@neotax.eu: USA
                expats@neotax.eu: Other
        phone:
            label: Phone
            id: contact_Phone
            autocomplete: 'on'
            type: tel
            validate:
                required: false
        contact-thru-phone:
            label: 'How would you like us to contact you?'
            id: contact_Select
            autocomplete: 'on'
            type: select
            default: 'no'
            options:
                'no': 'By e-mail'
                'yes': 'By phone'
        message:
            label: Message
            id: contact_Text
            type: textarea
            rows: 5
            validate:
                required: true
        g-recaptcha-response:
            label: Captcha
            type: captcha
    buttons:
        submit:
            type: submit
            value: Submit
    process:
        captcha: true
        save:
            fileprefix: kontakt-
            dateformat: Ymd-His-u
            extension: txt
            body: '{% include ''forms/data.txt.twig'' %}'
        email:
            from: '{{ form.value.send }}'
            to:
                - '{{ form.value.send }}'
                - '{{ form.value.email }}'
            subject: '[neotax.eu] {{ form.value.name|e }}'
            body: '{% include ''forms/data.html.twig'' %}'
content:
    items: '@self.modular'

this is a modular page. When sending emails, ajax returns a success message but there is no email to send and logs for email are empty... However, if I turn off the cache in grav, then everything works properly. Email v3.1.1 Grav v1.7.7

mahagr commented 3 years ago

This could be an issue with modular content. The form may not be found when you submit it. Tell us a bit more about how to replicate the issue with its simplest form and I can take a look.

rhukster commented 1 year ago

Cleaning up old issues. please read: https://getgrav.org/blog/new-email-plugin

Also in this case it looks like a problem with the form caching. Latest form plugin should address this.