*******************************************************************
If you need your results saved to a db or text file, or need file upload/attachment capabilities, then use the
TFMail script.
If you just need the results of your form emailed to you, then the
NMS FormMail script is a much simpler and faster script to configure.
*******************************************************************
Make sure you have the latest version of the
NMS FormMail script. Here's the link to download the file (it's the first one that says "compat") -->
Click hereHere's the changes/customizations you need to make to your configs (I recommend that you print out these instructions so you can follow it step-by-step, checkmarking each step as you finish them, so you do not miss anything):
THE FormMail.pl SCRIPT:Step 1) Change the name of the script from "FormMail.pl" to anything else you want (you
MUST change the name and
DO NOT use the words "form", "mail" or "contact" at all in the name, otherwise the script may be disabled by LP due to those words being used).
Step 2) Change the following configs (located at the beginning part of the script with the heading
# USER CONFIGURATION SECTION):
$mailprog = '/usr/sbin/sendmail -oi -t';
@referers = qw(yourdomain.com localhost);
@allow_mail_to = qw(user@yourdomain.com localhost);
From: user@yourdomain.com
* NOTE: "yourdomain.com" and
"user" should be replaced with whatever your domain name and email addy would be.
(If you are on a Windows Server click on this following link --> Click here and change your shebang line and $mailprog configs to what it says in the post - if you're NOT on Windows Server, DO NOT click on that link, cuz it will only confuse you and if you change those settings it will be incorrect
)DO NOT touch anything below the CONFIGURATION section (if you do not know perl) and
DO NOT remove ANY portion of the coding in the script!!!!!! You need all that stuff after the CONFIGURATION too, so just make the changes shown above, but
NO erasing/deleting anything!!
Step 3) Upload the .pl file to your
cgi-bin in
ASCII (text mode) and
chmod (set permissions) to
755 (to set permission via cPanel, follow these instructions -->
Click here)
THE HTML FORM:Step 1) the "action" tag should look like this:
<form method="post" action="/cgi-bin/scriptname.pl">
* NOTE: Replace
"scriptname" with whatever you named your formmail script to.
Step 2) The field where you want your visitors to enter their email addy must be written as -->
email- this is due to having the sender's email addy in the
"From:" section of the email that gets sent to you. If you write it any other way (ex: Email, e-mail, e_mail, etc.) the script will put
"nobody@server.lunarpages.com" in the
"From:" header of the email.
So, the source code for the form for that tag should look like:
<input type="textbox" name="email">
You might also want to make that field "required" so that the Submitter doesn't leave it blank (see
Step 3 below for details).
If you are not using separate "first" and "last" names fields, you might want to use
"realname" instead of just "name" for the following tag, like so:
Your Name: <input type="text" name="realname">
The script uses
"realname" in its code which will then put the person's name in the
"From:" section of the emailed results instead of just their email addy (their email will still be available to view in the properties and if you do a "reply" it will email to their email addy). Having their name show up instead of only the email addy has its advantages/benefits, especially for referencing purposes.
Step 3) Other hidden tags you may want to add (put these below the "action" tag):
<input type="hidden" name="subject" value="Form Submission">
<input type="hidden" name="required" value="email">
<input type="hidden" name="redirect" value="../thankyou.htm">
* NOTE: You replace the values with whatever applicable.
For the
"redirect", you can use either a relative path (as shown), or an absolute path (ex:
http://yourdomain.com/thankyou.htm). This is the page that the submitter will be taken to once they hit the "submit" button. If you do not put this tag in your form, the script will use their default "Thank You" (it's kinda plain).
For the
"required", if you want to have other fields included as well, add to the value string using commas (ex: "email,realname,phone"). This tag is used so the submitter can't leave the field blank.
Step 4) If you've used a previous version of formmail,
DO NOT put your email addy in the form under the
"recipient" hidden tag, because it's a vulnerability for spam email harvesting (the recipient of the form submissions is in your script under the
"@allow_mail_to").
So I repeat,
REMOVE the
"recipient" hidden tag if you have your email addy in it.
However, if you want to send the form results to
multiple email addys or assign different forms to certain email addys, then follow these instructions for the
"recipient" hidden tag -->
Click here* Also, scroll down to talloth_endill's post, as he shows how to use it with a drop-down menu/listTO CONCLUDE ...If you have successfully tested your script and all is working (no error messages), then you should go back into the
CONFIGURATION section of the .pl script and change the following from "1" to "0" as shown below:
$DEBUGGING = 0;
What this does is restrict the amount of information that a malicious person attacking your site can obtain.
If you receive errors after you have configured your script and html file, then:
1) Make sure that you have followed the above instructions EXACTLY, going through each step again to double-check.
2) Read my post in the following thread and check for those problems -->
Click hereMISCELLANEOUS ...If you're new at this, the above configs are all you need to modify for the script and html. However, if you're a little more adventurous/experienced, the
"README" file will have other "optional" modifications that can be used/made for various needs. Also, read the
"EXAMPLES" file, as well.
IMPORTANT ...If you have any problems,
DO NOT contact LP tech support. LP's tech support cannot help you (they are not obligated to do so with scripts), due to this is NOT a server-side/web hosting issue, and you will just add unnecessary support tickets to their workload which then puts other customers who really need tech support to wait longer in the queue.
If you need any further help, please
DO NOT post in this thread and
DO NOT send me a IM/PM (Private Message), because if I'm not available to help you right away, others will be able to, so you need to post in the
C++ / PERL / CGI (<-- click on that to go there now) section of the forums.
Your cooperation will be greatly appreciated ... THANK YOU!

)
Okay, that's it