How to create a Contact us form that sends email

Hi,

How can I create a standard contact us form?
After user submitting the forms, an email should also be sent.

Thanks for any help.

Hi, if you’re a developer who wishes to code a standard contact us form, you can use a servicesUrl with the sendmail service: https://enonic.com/docs/4.7/sendmail-service.html

In the case of the sendmail service, the whole purpose of the form is to send the submitted input values as an e-mail. As long as you don’t need any advanced e-mail formatting in the result, the sendmail service should be sufficient for a simple contact us form.

Many Enonic CMS sites also use the formbuilder module for this purpose. It’s a bit more complex than a simple form based on the sendmail service, but allows content producers to edit the forms themselves without involving developers, as well as storing the form submissions as content.
More info: https://enonic.com/docs/4.7/form-builder.html
Developer resources from the cms-packages repo (the one used by the demokit website):
https://github.com/enonic/cms-packages/blob/master/resources/modules/formbuilder/formbuilder.xsl
https://github.com/enonic/cms-packages/blob/master/portlets/formbuilder.xml

1 Like

Just to be clear on this - Bjørnar’s answers relates to Enonic CMS, not XP where you would implement a custom service yourself. :slight_smile: