{"id":1245,"date":"2024-07-05T12:40:19","date_gmt":"2024-07-05T12:40:19","guid":{"rendered":"https:\/\/zalvis.com\/docs\/?p=1245"},"modified":"2024-07-05T12:42:23","modified_gmt":"2024-07-05T12:42:23","slug":"creating-a-contact-form-with-formmail","status":"publish","type":"post","link":"https:\/\/zalvis.com\/docs\/creating-a-contact-form-with-formmail.html","title":{"rendered":"Creating a Contact Form with FormMail"},"content":{"rendered":"<p>FormMail is a very popular script that you can put onto your website so that visitors can fill it out and have their response emailed directly to you.<\/p>\n<p><strong>NOTE<\/strong>: To help you set up FormMail on your website we have previously written a <a href=\"https:\/\/zalvis.com\/docs\/formmail.html\">step-by-step guide to installing and configuring FormMail<\/a>.<\/p>\n<ol class=\"article_list\">\n<li>Download the \u201c<strong>compat<\/strong>\u201d version of the\u00a0<a href=\"http:\/\/nms-cgi.sourceforge.net\/scripts.shtml\" target=\"_blank\" rel=\"noopener noreferrer\">NMS FormMail <\/a>script.\n<div><\/div>\n<\/li>\n<li>Un-zip the downloaded file and upload the <em>FormMail.pl<\/em> script to your cgi-bin folder in your public_html folder.\n<div><\/div>\n<\/li>\n<li>Next you will need to modify the <em>FormMail.pl<\/em> file that was uploaded into your cgi-bin folder. First, you will need to change the <em>@referers<\/em>line (around line 47). Replace everything inside of the parentheses with your domain using the same formatting, once without the www and then a single space and again with the www.\n<div><\/div>\n<\/li>\n<li>This is where you input any email addresses that the forms will send to. Make sure you remove localhost from both the <em>@referers<\/em> and the <em>@allow_mail_to<\/em> lines (around lines 47 and 48, respectively.) Once you have made these two changes, save the file.\n<div><\/div>\n<\/li>\n<li>After adding the code to the page that you want the form on, you will need to point the action of the FORM tag to the <em>FormMail.pl<\/em>script inside the cgi-bin folder:<em>&lt;form action=&#8221;https:\/\/www.example.com\/cgi-bin\/FormMail.pl&#8221; method=&#8221;post&#8221;&gt;<\/em><\/li>\n<\/ol>\n<p>Next, inside of each of your forms you will need to include a few hidden input tags. They are detailed below:<\/p>\n<blockquote><p>&lt;input type=&#8221;hidden&#8221; name=&#8221;recipient&#8221; value=&#8221;you@your.domain,me@your.domain&#8221; \/&gt;<\/p><\/blockquote>\n<p>This tag tells the form which email address to send the form to. Just make sure that this email is one of the addresses in your <em>@allow_mail_to<\/em> field<\/p>\n<blockquote><p>&lt;input type=&#8221;hidden&#8221; name=&#8221;subject&#8221; value=&#8221;From the feedback form&#8221; \/&gt;<\/p><\/blockquote>\n<p>This is a optional tag you can input into your form to specify the subject line of the email that gets delivered to you.<\/p>\n<blockquote><p>&lt;input type=&#8221;hidden&#8221; name=&#8221;redirect&#8221; value=&#8221;https:\/\/www.your.domain\/foo.html&#8221; \/&gt;<\/p><\/blockquote>\n<p>This is another optional tag to specify where your users will be redirected to after they click the submit button.<\/p>\n<p>Finally in order for FormMail to work you must set the permissions on the <em>FormMail.pl<\/em> to <strong>755<\/strong>.\u00a0 This can be completed within your File Manager as well by right clicking on the file and selecting \u201cchange permissions.\u201d<\/p>\n<div class=\"tmqbn69f23ef9007f3\" >If you enjoyed this article, then you\u2019ll love Zalvis's Cloud Hosting platform. Turbocharge your website and get 24\/7 support from our veteran team. Our world-class hosting infrastructure focuses on auto-scaling, performance, and security. Let us show you the Zalvis difference! <a href=\"https:\/\/zalvis.com\/\">Check out our services.<\/a><\/div><style type=\"text\/css\">\r\n@media screen and (min-width: 1201px) {\r\n.tmqbn69f23ef9007f3 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 993px) and (max-width: 1200px) {\r\n.tmqbn69f23ef9007f3 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 769px) and (max-width: 992px) {\r\n.tmqbn69f23ef9007f3 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 768px) and (max-width: 768px) {\r\n.tmqbn69f23ef9007f3 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (max-width: 767px) {\r\n.tmqbn69f23ef9007f3 {\r\ndisplay: block;\r\n}\r\n}\r\n<\/style>\r\n","protected":false},"excerpt":{"rendered":"<p>FormMail is a very popular script that you can put onto your website so that visitors can fill it out and have their response emailed directly to you. NOTE: To help you set up FormMail on your website we have previously written a step-by-step guide to installing and configuring FormMail. Download the \u201ccompat\u201d version of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1245","post","type-post","status-publish","format-standard","hentry","category-email"],"_links":{"self":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/1245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/comments?post=1245"}],"version-history":[{"count":4,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/1245\/revisions"}],"predecessor-version":[{"id":1249,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/1245\/revisions\/1249"}],"wp:attachment":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/media?parent=1245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/categories?post=1245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/tags?post=1245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}