{"id":1237,"date":"2024-07-05T08:42:59","date_gmt":"2024-07-05T08:42:59","guid":{"rendered":"https:\/\/zalvis.com\/docs\/?p=1237"},"modified":"2024-07-05T12:44:36","modified_gmt":"2024-07-05T12:44:36","slug":"formmail","status":"publish","type":"post","link":"https:\/\/zalvis.com\/docs\/formmail.html","title":{"rendered":"How to Set up FormMail"},"content":{"rendered":"<p>In this guide, you can learn how to <strong>set up the NMS FormMail script<\/strong>.<\/p>\n<div class=\"alert alert-success\" role=\"alert\"><em><b>NOTICE:<\/b> You will need to download the\u00a0<a title=\"Click here to navigate to the nms Project website to download the FormMail script.\" href=\"https:\/\/nms-cgi.sourceforge.net\/scripts.shtml\" target=\"_blank\" rel=\"noopener\">NMS FormMail <\/a>script. Make sure to download the \u201c<b>compat<\/b>\u201d package.<\/em><\/div>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/zalvis.com\/docs\/formmail.html\/#Set_Up_FormMail\" >Set Up FormMail<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/zalvis.com\/docs\/formmail.html\/#Customize_FormMailpl_Script\" >Customize FormMail.pl Script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/zalvis.com\/docs\/formmail.html\/#Configure_Contact_Form\" >Configure Contact Form<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/zalvis.com\/docs\/formmail.html\/#Change_File_Permissions\" >Change File Permissions<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/zalvis.com\/docs\/formmail.html\/#Change_Permissions_Using_FTP\" >Change Permissions Using FTP<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Set_Up_FormMail\"><\/span>Set Up FormMail<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Customize_FormMailpl_Script\"><\/span>Customize FormMail.pl Script<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol>\n<li>Un-compress the downloaded file and upload the FormMail.pl script to your cgi-bin (you will only need to upload the FormMail.pl file, all other files are documentation).<br \/>\nThe next step is to modify the FormMail.pl that is inside your cgi-bin. There are only two lines that you will need to modify.<\/li>\n<li>The first is the <b>@referers<\/b> line. Replace everything inside of the parentheses with your domain, once without the www and then a single space and again with the\u00a0www You will need to do this for each domain that you will be sending from. Remember, only one space between each url. The line should look like the example below:@referers = qw(example.com www.example.com);<\/li>\n<li>Now, modify the <b>@allow_mail_to<\/b> line. Here you specify any email addresses that the forms will send to. Again, only one space between multiple email addresses. Also, make sure you remove the \u2018localhost\u2019 entry. The line should look like the example below:@allow_mail_to = qw(webmaster@example.com admin@example.com);<\/li>\n<li>Save the FormMail.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Configure_Contact_Form\"><\/span>Configure Contact Form<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol class=\"article_list\">\n<li>First, point the action of the <i>form<\/i> tag to the FormMail.pl script inside the cgi-bin.<br \/>\n<b>Pointing the the contact form to the FormMail.pl <\/b><br \/>\nThe following tag is necessary for your contact form to process the values in the form. Copy the code (below) and paste it into your Contact form\u2019s code.<span class=\"code_block\">&lt;form action=\u201dhttps:\/\/www.<i>example.com\/cgi-bin\/FormMail.pl<\/i>\u201d method=\u201dpost\u201d&gt;<\/span><\/p>\n<div class=\"alert alert-info\" role=\"alert\">\n<p><b>NOTE:<\/b> Be sure to replace <i>example.com<\/i>, with your actual domain name and <i>\/cgi-bin\/FormMail.pl <\/i>with the relative path to the file located on your server.<\/p>\n<\/div>\n<\/li>\n<li>Inside of your form you will also need to include a few hidden <i>input<\/i> tags. Copy the code (below) and paste it into your <i>contact form\u2019s code<\/i>.<br \/>\n<b>Add the recipient(s) of the email: <\/b><br \/>\nThis tag will configure the form to send to the specified email address(es).<span class=\"code_block\">&lt;input type=\u201dhidden\u201d name=\u201drecipient\u201d value=\u201d<i>webmaster@example.com,admin@example.com<\/i>\u201d \/&gt;<\/span><\/p>\n<div class=\"alert alert-warning\" role=\"alert\">\n<p><b>WARNING:<\/b> Make sure you replace <i>webmaster@example.com,admin@example.com <\/i>with an email address that is specified in your <b>@allow_mail_to<\/b>field of the <strong>FormMail.pl script<\/strong>.<\/p>\n<\/div>\n<p><b>Create the subject of the email:<\/b><\/p>\n<p>This tag tells the form the subject to create the email with.<\/p>\n<p><span class=\"code_block\">&lt;input type=\u201dhidden\u201d name=\u201dsubject\u201d value=\u201d<i>From the contact form<\/i>\u201d \/&gt;<\/span><\/p>\n<p><b>Redirecting the page to your own \u201cThank You\u201d page<\/b><\/p>\n<p>This is another optional tag to specify where your users will be redirected to after they click the submit button. If you do not include this they will be directed to a very generic looking page created by the FormMail script.<\/p>\n<p><span class=\"code_block\">&lt;input type=\u201dhidden\u201d name=\u201dredirect\u201d value=\u201dhttps:\/\/www.<i>example.com\/thankyou.html<\/i>\u201d \/&gt;<\/span><\/p>\n<div class=\"alert alert-info\" role=\"alert\">\n<p><b>NOTE:<\/b> Make sure to replace <i>example.com\/thankyou.html<\/i> with the actual page that you create for redirecting your visitor after a submission is made.<\/p>\n<\/div>\n<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Change_File_Permissions\"><\/span>Change File Permissions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"alert alert-danger\" role=\"alert\"><b>IMPORTANT:<\/b> One last thing that must be performed in order for the FormMail to work is that you must <b>set the permissions<\/b> on the <em>FormMail.pl<\/em> file to <u>755<\/u>.<\/div>\n<div role=\"alert\">\n<ol class=\"article_list\">\n<li>Log into cPanel.<\/li>\n<li>Click on the <b>File Manager<\/b> icon under the <i>Files<\/i> subheader.<\/li>\n<li>Browse to the <b>cgi-bin <\/b>by clicking on the folder icons for <b>public_html &gt; cgi-bin<\/b>.<\/li>\n<li>Once inside of the <i>cgi-bin<\/i> directory, right-click on the <strong>FormMail.pl<\/strong> file and click to select <b>Change Permissions<\/b>.<\/li>\n<li>Click the checkboxes to ensure that the <i>User<\/i> column has <b>read, write, and execute<\/b> checked and <i>Group<\/i> and <i>World <\/i>should have <b>read and execute<\/b> checked.<\/li>\n<li>Click the <b>Change Permissions<\/b> button to save these changes.<\/li>\n<\/ol>\n<h4><span class=\"ez-toc-section\" id=\"Change_Permissions_Using_FTP\"><\/span>Change Permissions Using FTP<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>If you are using an FTP client you will want to browse to the <i>cgi-bin<\/i>directory. Then right click on the <strong>FormMail.pl<\/strong> file and look for an option called <i>CHMOD<\/i>. This will open a dialog box where you can make the same changes as described in the cPanel file manager steps above. Make sure execute is turned on for all types of users and that the numbers have changed to 755.<\/p>\n<p><b>Congratulations!<\/b> Now you have a <strong>FormMail.pl script set up<\/strong> that you can use to <em>send email from a contact form on your website<\/em>.<\/p>\n<p><strong>NOTE<\/strong>: We have written a dedicated article on <a href=\"https:\/\/zalvis.com\/docs\/creating-a-contact-form-with-formmail.html\">creating a contact form with FormMail.pl script<\/a>. That is the next step of this article.<\/p>\n<\/div>\n<div class=\"mbmzr69e0b02f701f7\" >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.mbmzr69e0b02f701f7 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 993px) and (max-width: 1200px) {\r\n.mbmzr69e0b02f701f7 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 769px) and (max-width: 992px) {\r\n.mbmzr69e0b02f701f7 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 768px) and (max-width: 768px) {\r\n.mbmzr69e0b02f701f7 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (max-width: 767px) {\r\n.mbmzr69e0b02f701f7 {\r\ndisplay: block;\r\n}\r\n}\r\n<\/style>\r\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you can learn how to set up the NMS FormMail script. NOTICE: You will need to download the\u00a0NMS FormMail script. Make sure to download the \u201ccompat\u201d package. Set Up FormMail Customize FormMail.pl Script Un-compress the downloaded file and upload the FormMail.pl script to your cgi-bin (you will only need to upload the [&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-1237","post","type-post","status-publish","format-standard","hentry","category-email"],"_links":{"self":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/1237","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=1237"}],"version-history":[{"count":8,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/1237\/revisions"}],"predecessor-version":[{"id":1250,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/1237\/revisions\/1250"}],"wp:attachment":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/media?parent=1237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/categories?post=1237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/tags?post=1237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}