Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can’t get multiple emails to work #188

Open
eattext opened this issue Nov 8, 2024 · 1 comment
Open

Can’t get multiple emails to work #188

eattext opened this issue Nov 8, 2024 · 1 comment

Comments

@eattext
Copy link

eattext commented Nov 8, 2024

Thanks for all your work on this plugin. I’ve got the form on my website to work i.e. emails successfully sent and received on Submit using SMTP, but can’t make multiple emails work for some unknown reason.

The first method using two email process calls proceeds successfully to display: /formsubmit (confirmation page is shown with no errors), but only the first email (‘Copy to myself’) is sent:

    process:
        email:
            subject: "Copy to myself"
            body: "{% include 'forms/data.html.twig' %}"
            from: "{{ config.plugins.email.from }}"
            to: "{{ config.plugins.email.to }}"
        email:
            subject: "Copy to user"
            body: "{% include 'forms/data.html.twig' %}"
            from: "{{ config.plugins.email.from }}"
            to: "{{ form.value.email }}"
        display: /formsubmit

The second method, using the recommended syntax/array, doesn’t seem to proceed successfully to display: /formsubmit i.e. a slightly broken page (wrong template?) is displayed, but the first email (‘Copy to myself’) is successfully sent and received:

  process:
       email:
           - 
               subject: "Copy to myself"
               body: "{% include 'forms/data.html.twig' %}"
               from: "{{ config.plugins.email.from }}"
               to: "{{ config.plugins.email.to }}"
           - 
               subject: "Copy to user"
               body: "{% include 'forms/data.html.twig' %}"
               from: "{{ config.plugins.email.from }}"
               to: "{{ form.value.email }}"
       display: /formsubmit

Swapping positions of email blocks produces the same result i.e. first email only sent (this time, ‘Copy to user’), suggesting that there’s nothing wrong with the variables.

Same result if using Sendmail instead of SMTP. PHP is version 8.2.

Any idea on what the problem is here?

@eattext
Copy link
Author

eattext commented Nov 8, 2024

Update:
The following code listing all keys under process as an array seems to work:

    process:
      - email:
            subject: "Copy to myself"
            body: "{% include 'forms/data.html.twig' %}"
            from: "{{ config.plugins.email.from }}"
            to: "{{ config.plugins.email.to }}"
      - email:
            subject: "Copy to user"
            body: "{% include 'forms/data.html.twig' %}"
            from: "{{ config.plugins.email.from }}"
            to: "{{ form.value.email }}"
      - display: /formsubmit

Still not clear on why the second method doesn’t work, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant