by Susan Vollmer <susanvollmer(at)yahoo.com>

 Date:  Sat, 3 Mar 2001 17:20:16 -0800 (PST)
 To:  "HWG Techniques \(E-mail\)" <hwg-techniques(at)mail.hwg.org>
  todo: View Thread, Original
FYI.  I receive a request off list for details on how
to use Matt's FormMail.  I responded to that but
thought there may be others who would want to see
this.

I'm not an expert since I've only done one form
results via email.  If anyone else wants to add input,
that's fine.

If you want this in a Microsoft Word document, which
is color coded, send an email to me at: 
susanvollmer(at)yahoo.com

Hope this is useful.  For troubleshooting, please send
to the list.

Regards,
Susan

=========== FORM MAIL GUIDELINES BELOW ============

(Guidelines for using Matt's Form Mail:  information
in UPPERCASE or red you will need to modify to match
your particular site.)


STEP 1:  (Questions for web host provider)


Contact your web host provider and ask these questions
if you don't already know the answers:

--Do I have the ability to receive email from my
hosted web site?  How do I set up?

--What type of server is my site placed on, Unix or
something else-please identify.  (Note: if it's Unix,
then these guidelines are appropriate for you.  If
not, try to find another source to give you guidelines
on using form mail for the type of server you are
using.)

--I plan to use Matt's Script for Form Mail.  Do I
have access to the cgi-bin?

--If so, would my path in the html form be: 
"http://www.INSERTYOURDOMAINHERE.COM/cgi-bin/ "

--Currently the mail program path the script is using
is:   '/usr/lib/sendmail'
Does that match your setup?  If not, what should I
use?

--The shebang line in the script has this path
identified:     #!/usr/bin/perl
Does that match your setup?  If not, what should I
use?
(Note: the shebang line tells Unix where to find the
Perl interpreter program so that it can run the
script.)


----------------------------------------------------------------------------------------


STEP 2:  (Add this information to your html form)

After you receive the answers from the web hosting
provider, you will know if and how to proceed with
this process.  Again, this example is based on a Unix
server.

Verify that you can receive email from your domain
name to the actual email provider you plan to have the
form data sent to for testing.  Create and design your
form in html.  Place this coding in your html where
the form starts:


< form
action="HTTP://WWW.INSERTYOURDOMAINHERE.COM/CGI-BIN/
YOURSCRIPTNAME.CGI"      method="post"   >

<input type=hidden    name="recipient"   
value="YOUREMAILHERE(at)YOURADDRESS.COM"   


(Note:  The preceding code is required with your
modifications to the text in red to use Matt's Form
Mail.  The following code is optional.  There are more
choices to include if you read the detail at this site
but the information below is not required to make it
work.  These just happened to be the options I was
most interested in.)


(optional coding to insert in html form if desired)


<input type=hidden          name="return_link_url"  
value=""HTTP://WWW.INSERTYOURDOMAINHERE.COM">


 <input type=hidden         name="return_link_title" 
value="Back To Home Page">


<input type=hidden          name="subject"      	 
value="YOURSUBJECTLINE">


 <input type=hidden         name="required"     	 
value="EMAIL, USERNAME">
<!-- Note this is for any fields that you want to make
required.  Make sure that spelling and uppercase or
lowercase match the name of the fields you used when
designing the form. -->

<input type=hidden  name="env_report"   	 
value="REMOTE_HOST,HTTP_USER_AGENT">
<!-- Note these values are uppercase because Unix
requires it but this code can be used as is.  This is
referring to the environmental variables which tell
you what type browser operating system the user was
accessing when sending the form. -->

----------------------------------------------------------------------------------------


STEP 3:  (Modify the CGI script)

Use this link to go to the page where Matt's Scripts
for downloading are at.  You will have your choice of
several formats, including WinZip and Unix.

http://www.worldwidemart.com/scripts/formmail.shtml#Downloading


Once you have the script, there are only three things
that you need to either verify or modify.

To be able to open up the script and modify it, some
persons use the Pico editor of Unix.  Although I did
not do this, I also believe some people may rename the
script as txt file, edit in Notepad and then rename as
cgi file and upload to server.  

I did my editing in dos.  On a PC, you would do the
following.  
--First write down the exact path of where you
downloaded the script to your hard drive.
--To go the DOS prompt, you could:
      Hold down Start button
        Go to Programs
             Accessories
                 MS-Dos Prompt

Once at the Dos Prompt type:
edit c:\YOUR_DIRECTORY\SUBDIRECTORY\SCRIPTNAME.EXT

(Note:  You may have more or less subdirectories
depending on where you saved it.)


Again, once you have the ability to edit the script,
there are only 3 places you need to verify or modify. 
I added the "*** Item numbers" to point this out; it's
not part of the script and shouldn't be.

*** Item 1:    #!/usr/bin/perl    (does this path
below match what the web host said)
#!/usr/bin/perl               
########################################################################
# FormMail                        Version 1.6         
                      #
# Copyright 1995-1997 Matt Wright
mattw(at)worldwidemart.com                    #
# Created 06/09/95                Last Modified
05/02/97                     #
# Matt's Script Archive, Inc.:   
http://www.worldwidemart.com/scripts/      #
########################################################################
# COPYRIGHT NOTICE                                    
                      #
# Copyright 1995-1997 Matthew M. Wright  All Rights
Reserved.                #
#                                                     
                      #
# FormMail may be used and modified free of charge by
anyone so long as this #
# copyright notice and the comments above remain
intact.  By using this      #
# code you agree to indemnify Matthew M. Wright from
any liability that      #
# might arise from its use.                           
                      #
#                                                     
                      #
# Selling the code for this program without prior
written consent is         #
# expressly forbidden.  In other words, please ask
first before you try and  #
# make money off of my program.                       
                      #
#                                                     
                      #
# Obtain permission before redistributing this
software over the Internet or #
# in any other medium.	In all cases copyright and
header must remain intact #
########################################################################
# Define Variables                                    
                      #
#	 Detailed Information Found In README File.         
                #

# $mailprog defines the location of your sendmail
program on your unix       #
# system.                                             
                      #

*** Item 2: '/usr/lib/sendmail'; (does this path below
match what the web host said)

$mailprog = '/usr/lib/sendmail';

# @referers allows forms to be located only on servers
which are defined     #
# in this field.  This security fix from the last
version which allowed      #
# anyone on any server to use your FormMail script on
their web site.        #


*** Item 3:   (Change 'YOURDOMAINNAME.COM' to just the
base domain name (URL) that you are creating the form
for.)

@referers = ('YOURDOMAINNAME.COM');

# Done                                                
                      #
########################################################################

----------------------------------------------------------------------------------------


STEP 4:  (Upload files and chmod if needed)


FTP your html file as an ascii file to the appropriate
directory  and any related graphics / pictures as
binary files to the appropriate directory.

Change your target directory to the cgi-bin or bin or
whatever its called, and upload your cgi script as an
ascii file to that location.

My host provider must have already opened up the
restrictions for me on the bin.  If not, you have to
find out how to access the unix command line and type
in:

      chmod 755    YourScriptName.cgi


chmod needs to be lowercase.  It stands for change
mode to open restrictions for your use.   Typeover
YourScriptName and give it the name you used for the
script and which you referred to in your form action
line.  This should be the same name.

If you find the Unix command line, a few commands
which might help you are:

which perl      or       whereisperl     
(identifies the path for the shebang line at top of
script)

which sendmail			
(identifies the path for the $mailprog in the script)

perl -cw    YourScriptName.cgi       
(check the syntax of the script and lets you know if 
OK or if errors exist)


----------------------------------------------------------------------------------------


STEP 5:  (Test and see if it works)


Call up your html file and see if it works.  After you
click the Send button, you should receive an automatic
"Thank You" page with a summary of the data that was
typed in.

Then check the email address where you were having the
results forwarded to.  The data should also be in the
email.

If you receive an error, here are some common ones:

403 Forbidden - most likely means that chmod needs to
be done on the scriptname so that permissions are
released.

404 Not Found - either the html file or the cgi script
can't be loaded by the server.  Verify that you
uploaded the files to the right directories,
especially cgi to the cgi-bin, if that is its name. 
See if the code in your html form action line has the
right name of the cgi script and the right path to
access it.


If you can't find the error, then submit to the list
with your error message, a link to your form and
script.


------------  end  ------------------










__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA