Friday, March 21, 2008

NMS Scripts

Safe, easy, and user-friendly. Wait, did you say there was a script out there that was user friendly?

Uh huh.

NMS scripts, available at sourceforge.net are well known as being safe and user friendly. I know first hand, now, because I just edited the PERL script used in my own contact form to make it work for me, and to not only send the mail from contact forms to my admin account at MyspaceSpiceShop, but to also send a copy of the email to my gmail account. Not bad, huh? I'd say it's awesomesauce, because I still don't know a lick of PERL.

Let's get specific, though. Step one, download your script here. Why? because they always have the most updated version.

Second, one Lunarpages member was nice enough to put a How To up for other people to use it. It can be found here. I printed it out and went line by line to make sure I set it up right. In case the post ever gets moved, deleted, or archived, I'm going to paste it here. I have a handful of issues with this, because everything else I give on advice is my own, but I really want this to be available to other people. I want to stress this, this is NOT my advice, but the sound advice of someone I heeded to set up my contact page.

*******************************************************************
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 here

Here'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):

Code:

Code:

Code:

Code:

* 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 Smile)


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:

Code:

* 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:

Code:

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:

Code:

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):

Code:

* 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/list

TO 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:

Code:

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 here

MISCELLANEOUS ...

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! Luff Ya)

Okay, that's it Thumbs Up
************************

I hope this helps!

1 comment:

ross said...

Great guide!

It may be worth while adding CAPTCHA support to your nms FormMail implementation to try and cut down on spam.

One possible implementation can be found at http://www.ramblingross.co.uk/2010/08/09/recaptcha-and-nms-formmail-part-i/