I created a new type of contact form. It is called "Invitation".

The problem is that the recipient field does not appear and it is not editable.

I want the user to fill in the recipient's email to send invitations.

How to let the user fill in the "Recipient" field of the contact form ?

enter image description here

  • Not sure if the "contact form" functionality is a proper fit for an invitation form. – baikho Nov 17 '20 at 18:05
  • @baikho Why can't the contact form do this? I just need to edit the "Recipient" field and create a TWIG template to create an invitation email. The user fills in the destination with an address and clicks "Send". – fred556 Nov 17 '20 at 18:37
  • Maybe have a look at the Webform module to build your own contact form the way you need it. I think it already comes with the option to submit the form to an email address from user input (which could be a select, radios or just a textfield I think). – leymannx Nov 17 '20 at 20:52
  • Another alternative would be to provide your own custom module to alter the contact form and the submit function. – leymannx Nov 17 '20 at 20:54
  • This contact form will be unique and accessible by authenticated users and with a special role – fred556 Nov 18 '20 at 11:39

The recipient isn't a Drupal field so I don't think this can be done without custom coding.

This is probably to guard against using the form for spamming. If the recipient field were accessible to anonymous users, then anyone could use the form to send unsolicited emails.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.