Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Contact Form: Confirmation to any email address

Solved by pamtbaau View solution

Started by Simon 5 years ago · 5 replies · 777 views
5 years ago

When a person send the contact form, they get a confirmation, or they can send the email to whoever they put in the email box.
How can I turn this off please?
I found this but it doesn't appear to help.
Thanks for any pointers.

5 years ago

@SimonJ, The question is not quite clear and open for multiple interpretations...

My guess is you do not want to prevent a user to fill-in an email address for confirmation and/or follow up, but want to prevent something else.

Would you mind sharing what exactly you are trying to prevent?

5 years ago

Yes sorry, the user fills in their name, email address and message.
Then the form is sent to me, but it is also sent to them.
I would like to stop the send to them. they already get a thank you page, it is not needed to email a copy to the user as well.
I am also concerned the address is not checked, so a spammer can use this form to send many emails.
[code]

title: 'Contact Me'
form:
name: contact
fields:
name:
label: Name
placeholder: 'Enter your name'
autocomplete: 'on'
type: text
validate:
required: true
email:
label: Email
placeholder: 'Enter your email address'
type: email
validate:
required: true
message:
label: Message
placeholder: 'Enter your message'
type: textarea
validate:
required: true
buttons:
submit:
type: submit
value: Submit
reset:
type: reset
value: Reset
process:
save:
fileprefix: contact-
dateformat: Ymd-His-u
extension: txt
body: '{% include ''forms/data.txt.twig'' %}'
email:
subject: '[Site Contact Form] {{ form.value.name|e }}'
body: '{% include ''forms/data.html.twig'' %}'
message: 'Thank you for getting in touch!'
display: thankyou

[/code]
This is the form.

last edited 08/04/21 by Simon
5 years ago Solution

@SimonJ, In that case, use a solution similar to the one referenced by @Karmalakas

TWIG
process:
    - email:
        from: "{{ config.plugins.email.from }}"
        to: "{{ config.plugins.email.to }}"
        subject: '[Site Contact Form] {{ form.value.name|e }}'
        body: "{% include 'forms/data.html.twig' %}"
   - message: 'Thank you for getting in touch!'
        display: thankyou

There will be no emails sent to the address entered by the visitor and your contact form cannot be used to sent emails to anyone else but you.

It does not prevent the form to be used for spam though... For that, you need a honeypot field, captcha field, or your own plugin to check the contents of subject/message to detect spam patterns/words.

👍 1
5 years ago

@pamtbaau:

TWIG
     from: "{{ config.plugins.email.from }}"
        to: "{{ config.plugins.email.to }}"

Perfect thank you.
I have the nospam plugin checking for URL entries and so far no problems.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 85 13 hours ago
General · by pamtbaau, 18 hours ago
1 60 18 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 350 5 days ago
General · by Duc , 6 days ago
3 44 5 days ago