Hi there!
I’m trying to build a contact form and though i tried to follow docs, it seems I’m still missing something.
On my server I have postfix installed with all the needed certificates to send emails.
If i run this command sudo bin/plugin email test-email -t <my-email>
I receive it.
But if I fill the grav form and submit, it seems the service doesn’t even get called.
This is my email plugin configuration:
enabled: true
from: <my-domain>
to: <my-email>
mailer:
engine: smtp
smtp:
server: <my-server-ip>
port: 25
encryption: none
user: null
password: null
sendmail:
bin: "/usr/sbin/sendmail -bs"
content_type: text/html
debug: true
cc: null
bcc: null
reply_to: null
body: null
and this is my contact form frontmatter
---
title: Contact us
cache_enable: false
description: Feel free to reach out! We’ll get back to you as soon as possible.
template: partials/components/form-contact-us
process:
twig: true
markdown: false
form:
action: /contacts
name: contact_form
fields:
- name: name
label: Name
type: text
placeholder: Enter your name
validate:
required: true
- name: surname
label: Surname
type: text
placeholder: Enter your surname
validate:
required: true
- name: email
label: Email
type: email
placeholder: Enter your email
validate:
required: true
- name: message
label: Message
type: textarea
placeholder: Enter your message
validate:
required: true
min: 10
buttons:
- type: submit
value: Send
process:
email:
- from: "{{ config.plugins.email.from }}"
to: "{{ config.plugins.email.to }}"
subject: "New Message from {{ form.value.name|e }} {{ form.value.surname|e }}"
body: |
Hi,
You have received a new message.
**Name:** {{ form.value.name|e }}
**Surname:** {{ form.value.surname|e }}
**Email:** {{ form.value.email|e }}
**Message:**
{{ form.value.message }}
message: "Thank you for getting in touch!"
reset: true
---
and here is the twig template \user\themes\quark\templates\partials\components\form-contact-us.html.twig
type or paste code here
<section class="form-contact-us-wrapper">
<div class="form-contact-us">
<div class="header">
<h3>{{ module.header.title }}</h3>
<span>{{ module.header.description }}</span>
</div>
<form method="post" action="{{ page.url }}">
<ul class="controls">
<li class="control">
<label for="name">{{ "NAME"|t }}</label>
<input type="text" id="name" name="name" placeholder="{{ "ENTER_YOUR_NAME"|t }}" required>
</li>
<li class="control">
<label for="surname">{{ "SURNAME"|t }}</label>
<input type="text" id="surname" name="surname" placeholder="{{ "ENTER_YOUR_SURNAME"|t }}" required>
</li>
<li class="control">
<label for="email">{{ "EMAIL"|t }}</label>
<input type="email" id="email" name="email" placeholder="{{ "ENTER_YOUR_EMAIL_ADDRESS"|t }}" required>
</li>
<li class="control">
<label for="message">{{ "MESSAGE"|t }}</label>
<textarea id="message" name="message" placeholder="{{ "ENTER_YOUR_MESSAGE"|t }}" required minlength="10"></textarea>
</li>
</ul>
<button type="submit" title="{{ "SEND"|t }}">{{ "SEND"|t }}</button>
</form>
</div>
</section>