{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:40Z","object_id":{"id":2901,"is_a":["text","documentation","userguide"],"name":"editor_creating_form","title":{"_type":"trans","tr":{"en":"Creating your first form"}},"uri":"https:\/\/zotonic.com\/id\/2901"},"seq":1},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2906,"is_a":["text","documentation","userguide"],"name":"editor_survey_email","title":{"_type":"trans","tr":{"en":"Sending form notifications and confirmations"}},"uri":"https:\/\/zotonic.com\/id\/2906"},"seq":2},{"created":"2026-10-07T11:13:40Z","object_id":{"id":1419,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_forms_and_validation","title":{"_type":"trans","tr":{"en":"Validate a form on both sides"}},"uri":"https:\/\/zotonic.com\/id\/1419"},"seq":3},{"created":"2026-10-07T11:13:40Z","object_id":{"id":3068,"is_a":["text","documentation","adminguide"],"name":"admin_test_email","title":{"_type":"trans","tr":{"en":"Direct test mail to a controlled recipient"}},"uri":"https:\/\/zotonic.com\/id\/3068"},"seq":4}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"references":{"objects":[{"created":"2020-05-30T05:47:59Z","object_id":{"id":1327,"is_a":["text","documentation","reference","template_scomp"],"name":"doc_template_scomp_scomp_wire","title":"wire","uri":"https:\/\/zotonic.com\/id\/1327"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"refers":{"objects":[{"created":"2026-10-07T11:13:02Z","object_id":{"id":1316,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_survey","title":"mod_survey","uri":"https:\/\/zotonic.com\/id\/1316"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"relation":{"objects":[{"created":"2020-05-30T05:47:59Z","object_id":{"id":1279,"is_a":["text","documentation"],"name":"doc_glossary","title":"Glossary","uri":"https:\/\/zotonic.com\/id\/1279"},"seq":1000000},{"created":"2020-05-30T05:47:59Z","object_id":{"id":1552,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_email","title":{"_type":"trans","tr":{"en":"Configure outbound email and verify delivery"}},"uri":"https:\/\/zotonic.com\/id\/1552"},"seq":1000000}],"predicate":{"id":303,"is_a":["meta","predicate"],"name":"relation","title":{"_type":"trans","tr":{"nl":"Relatie","en":"Relation"}},"uri":"http:\/\/purl.org\/dc\/terms\/relation"}},"subject":{"objects":[{"created":"2026-10-07T11:13:40Z","object_id":{"id":2557,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_cookbook_recipe","title":"Cookbook recipe","uri":"https:\/\/zotonic.com\/id\/2557"},"seq":1},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":3},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2582,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_forms","title":"Forms","uri":"https:\/\/zotonic.com\/id\/2582"},"seq":4},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2584,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_surveys","title":"Surveys","uri":"https:\/\/zotonic.com\/id\/2584"},"seq":5},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2595,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_email_delivery","title":"Email delivery","uri":"https:\/\/zotonic.com\/id\/2595"},"seq":6},{"created":"2026-10-07T11:13:40Z","object_id":{"id":2685,"is_a":["categorization","keyword","keyword_quality"],"name":"zotonic_topic_security","title":"Security","uri":"https:\/\/zotonic.com\/id\/2685"},"seq":7}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1582,"is_a":["text","documentation","cookbook"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1582"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_cookbook_frontend_contactform","page_url":{"en":"https:\/\/zotonic.com\/cookbook\/1582\/add-a-contact-form","x-default":"https:\/\/zotonic.com\/cookbook\/1582\/add-a-contact-form"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>For an ordinary contact form, enable <a href=\"\/id\/1316\" class=\"doc-reference doc-reference-module\"><code>module#mod_survey<\/code><\/a>, create a form, add the required questions, and configure its response email. Test required fields, an invalid email address, and a successful submission. Use the editor survey tasks for the complete workflow.<\/p>\n<h2>When a custom handler is needed<\/h2>\n<p>Build a wired form and an exported <code>event\/2<\/code> handler in an active module. Use validators for required fields and email syntax. In a <code>#submit{}<\/code> handler, read fields with <code>z_context:get_q_validated(&lt;&lt;&quot;email&quot;&gt;&gt;, Context)<\/code> and equivalent binary keys. Do not substitute <code>get_q<\/code> and assume the browser&#39;s checks are enough.<\/p>\n<p>Send to a <strong>configured recipient<\/strong>, not a posted destination. Pass the visitor&#39;s address as a reply-to value through the mail API, not as raw headers. Render the email with a template that escapes submitted text. For a basic template email, use <code>z_email:send_render\/4<\/code>. When a reply-to address is needed, use <code>z_email:send\/2<\/code> with an <code>#email{reply_to = Address, html_tpl = Template, vars = Vars, to = Recipient}<\/code> record. Handle <code>{ok, MessageId}<\/code> and <code>{error, Reason}<\/code> separately before updating the form. Queued mail is not proof of delivery.<\/p>\n<p>Keep the fields when sending fails and show a useful retry message. Add rate limiting or the installation&#39;s spam controls before exposing the form publicly. Do not log the message body or dump all submitted values. Test the mail queue, recipient delivery and failure path in acceptance.<\/p>\n<p>The old <code>mod_emailer<\/code> call and unvalidated example are obsolete. Refer to <a href=\"\/id\/1316\" class=\"doc-reference doc-reference-module\"><code>module#mod_survey<\/code><\/a> and the current <code>z_email<\/code> source in <code>zotonic_core<\/code> when implementing a custom delivery path.<\/p>"}},"category_id":{"id":318,"is_a":["meta","category"],"name":"cookbook","title":{"_type":"trans","tr":{"en":"Cookbook"}},"uri":"https:\/\/test.zotonic.com\/id\/318"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:27Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[1419,2901,2906,3068],"subject":[2557,2563,2564,2582,2584,2595,2685]},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/cookbook\/frontend-contactform.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T11:13:50Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"doc_cookbook_frontend_contactform","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2022-02-15T10:01:22Z","slug":"add-a-contact-form","summary":{"_type":"trans","tr":{"en":"Choose a survey form or implement a validated server-side mail handler."}},"title":{"_type":"trans","tr":{"en":"Add a contact form"}},"title_slug":{"_type":"trans","tr":{"en":"add-a-contact-form"}},"tz":"UTC","uri":null,"version":44,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/1582","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1582"}},"status":"ok"}