Create a form in a modular page

I have a modular page contact.html.twig that contains a form

Name Send

I wanna send an email that contains the form content and show a thank you message when I click the send button.

I tried to add this code to file
items: '@self.modular
by: default
dir: asc
- _about
- _feed
- _team
- _partners
- _contact
action: /01.home/_contact
name: my-nice-form
name: name
label: Name
placeholder: 'Enter your name’
autofocus: 'on’
autocomplete: 'on’
type: text
default: test

and creating a file user/config/plugins/email.yaml:
enabled: true
from: 'my_email’
from_name: 'my_name’
engine: mail
server: localhost
port: 25
encryption: none
user: 'xxxxx’
password: 'xxxx’
bin: '/usr/sbin/sendmail’
content_type: text/html

But I don’t know how to connect my form in contact.html.twig to all of them and make it work.

Thank you in advance

You don’t need to put the form HTML code manually.

What you need to do is create a in a modular child page, and that will create the form fields, and take care of the form processing.

To send emails you’ll need to add a action to the form definition in the file.

It’s all explained in Using forms in modular pages in details.

Here’s a live example of a modular page used in the Deliver skeleton: and You can download the skeleton and try it too.

Thank you for your answer. I did what you said but my question now is how to add CSS classes to my form

نيك نيك