Insert node title in the message sent by contact form I'am looking for a way to insert a node title to mail message sent by contact form in Drupal 8.

A contact form is inserted into my node as a field. It is used on each node to receive mail from users. But I need to specify what node the email was sent with.

I use MYMODULE_mail_alter to format mail message. How can i insert node title to mail subject and body?

Or is it possible to get node title in MYTHEME_form_alter ?
The current node is available from the route match, \Drupal::routeMatch()->getParameter('node'). Make sure it really is an instance of NodeInterface before you continue or check the route name.

Then it's easy to use $node->getTitle() as the default value for the subject of the contact form. Depending on what you want to do, you can then also hide the subject field.