cihanandac
(Cihan Andac)
September 19, 2023, 11:59am
1
Hello everyone,
I want to send confirmation emails to the people who submitted the form. Has anyone used this on their websites before? I was searching if there is a default option that I can use for this purpose. I would be glad if you can share your experiences about this.
I am using:
Volto 16.21.3
Plone 6.0.5
Volto-form-block: 3.1.0
Volto: Form support
Hey @cihanandac !
I've a couple of PRs open with this exact functionality:
collective:main
← collective:send-to
opened 02:10PM - 13 Dec 22 UTC
See collective/volto-form-block#57 for more details
collective:main
← collective:send-to
opened 02:00PM - 13 Dec 22 UTC
This PR changes the 'send' field to be a multi-select, letting you select 'recip… ient' or 'acknowledgement'. When acknowledgement is selected, a dropdown for which field to send the acknowledgement appears (and if there is only one email field will be pre-filled with that field). Then a rich text field is visible below letting the editor create a custom message to send. This custom message is then sent to the user filling out the form
Required collective/collective.volto.formsupport#24
## Sample
<img width="1788" alt="Screenshot of the new settings. The 'Send' field is now a dropdown and has the values of 'recipient' and 'acknowledgement'." src="https://user-images.githubusercontent.com/30210785/207350562-7ff47962-e6b3-4bbf-a772-a049853d46f8.png">
### Email sent to recipient
```
From: noreply@plone.org
To: jeff.bledsoe@pretagov.com.au
Subject: Test
Reply-To: noreply@plone.org
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Date: Tue, 13 Dec 2022 13:56:51 +0000
<p>A new form has been submitted from <strong>Volto form block (custom send=
to)</strong>:</p>
<ul>
=20
<li>
<strong>Text:</strong> Test
</li>
=20
<li>
<strong>My email field:</strong> jeff.bledsoe@pretagov.co.uk
</li>
=20
</ul>
````
### Email sent sent as acknowledgement
```
From: noreply@plone.org
To: jeff.bledsoe@pretagov.co.uk
Subject: Test
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Date: Tue, 13 Dec 2022 13:56:52 +0000
<p>This is an email to <a href=3D"http://jeffersonbledsoe.com/" rel=3D"noopene=
r noreferrer">the submitter</a></p><p>Thank <strong><u>you</u></strong> for s=
ubmitting this form!</p><p><em>All the best,</em></p><p><em>Jeff</em></p>
```
There's still some things to tidy up in the backend package, but we've been using this in a couple of our sites for a few months now without any issues
cihanandac
(Cihan Andac)
September 19, 2023, 1:25pm
3
Thank you so much @JeffersonBledsoe for sharing these PRs. This is so helpful. I will definitely look at them and see if I can apply to my project. And hopefully they can be accepted soon to the repository so that it can come out of the box.
1 Like
cihanandac
(Cihan Andac)
September 20, 2023, 9:55am
4
I add this to my project and after few changes it is working great. Thank you so much @JeffersonBledsoe for this contribution.
I wanted to add my notes about implementing so maybe you can change this or maybe in future someone reads it and use it to implement this feature.
On the form.py (line 293), I have changed the value to 'store' instead of 'send'.
I also changed the 'formSchema.js' to use this value in line 76:
...(formData?.store &&
Array.isArray(formData.store) &&
formData.store.includes('acknowledgement')
? ['acknowledgementFields', 'acknowledgementMessage']
: []),
Thanks for the feedback! You raised a good use case, you might want to send the acknowledgement on either send or store. I’ll adjust the PRs when I get the chance to account for this