How can single form send two emails using different titles and bodies

I’m trying to figure out how to specify the output of a form.
The standard output is enough for the configured emailaddress, but for the form-email i want a different format with output. How do i do this?

        - email:
            from: "{{ }}"
              - "{{ }}"
              - "{{ }}"
            subject: "[Aanmeldformulier] {{|e }}"
            body: "{% include 'forms/data.html.twig' %}"```

I need to figure out how to specify a second body/subject for {{ }}.

I have setup my email form to display a simple html format in the email within the body. What you need to do is change this line from:

body: "{% include 'forms/data.html.twig' %}" 


body: "{% extends 'email/base.html.twig' %}"
  • In your theme templates folder, create an ‘email’ folder inside templates/
  • Download this html email template and upload the base.html.twig to the email folder.
  • Test the template by filling out the contact form. You should receive a customize message containing the contact’s info. Verify and tweak however you want the body of the email to read.

Thanks but this is not what i am looking for… any other suggestions?

@SjoerdSmeets It might be worth considering to rephrase the question and explaining what you do look for… :wink:

After some pondering… Do you perhaps mean that you want to send two different emails, each with its own to/subject/body? One to yourself and one to {{ }}?

I have no hands-on experience with the Email plugin, but have you tried splitting the email action into two separate actions? One to yourself and one to the client each with their own to/subject/body?

That’s exactly what i want!

@SjoerdSmeets And? Have your tried the suggestion of sending two different ‘email’ actions?

I’m still looking for an example howto do this… haven’t found it yet…

@SjoerdSmeets With some help of the Form docs, albeit a bit hidden I have to admit… The following seems to be doing what you are looking for.

Note: I used a fresh install of Grav 1.6.0-beta.6 with Quark and an inherited theme.

  • Create a new page with a contact form:
  • Add the following frontmatter with two separate email actions:
    title: Contact Form
        name: contact
            - name: name
              label: Name
              placeholder: Enter your name
              autocomplete: on
              type: text
                required: true
            - name: email
              label: Email
              placeholder: Enter your email address
              type: email
                required: true
            - name: message
              label: Message
              placeholder: Enter your message
              type: textarea
                required: true
            - type: submit
              value: Submit
            - type: reset
              value: Reset
            - email:
                # To myself
                to: "{{ }}"
                subject: "Email to myself"
            - email:
                # To visitor
                # Using defaults for 'to' and 'from'
                subject: "Email to visitor"
                body: "{% include 'forms/visitor.html.twig' %}"  <-- a custom template
    # Contact form
    Some sample page content
  • In your inherited theme create a new Twig template ‘users/themes/mytheme/templates/forms/visitor.html.twig’. Add the following content:
    <p>This is the body for the visitor's email based on template "forms/data.html.twig"
    which can be found in folder "/user/plugins/form/templates/forms/".</p>;
    {% include "forms/data.html.twig" %} 

Hope this helps...

That’s it, thank you very much!

@SjoerdSmeets Nice!

I have taken the liberty to change the title of your post to match your intention a tad better.