######################################################################
##################     form_mail.cgi  version 1.0 ####################
######################################################################                        
# Form Mail Plugin for perlshop.cgi                                  #
# Author : Chris Jacobs.(aka Jack)                                   # 
#          (email: Jack@sarune, chris_jacobs_nj@yahoo.com)           #
#                                                                    #
#   I created this form mail script specifically for use with the    #
#                 shopping cart program PERLSHOP                     #
#                The latest version is available from                #
#                       waveridersystems.com                         #
#                                                                    #
#           WORKING DEMO  @ www.sarune.com/Sarunatic/                #
#                                                                    #
######################################################################
# Revision History                                                   #
######################################################################
# Version 1.0                                                        #
#                                                                    #
######################################################################
#                                                                    #
#              Any suggestions, comments, questions                  #
# for improving the script or this ReadME file please send me eMail  #
#          jack@sarune.com   OR  chris_jacobs_nj@yahoo.com           #
#                and I will do my best to help out                   #
#                          Thank you, Jack                           #
#                                                                    #
#    This script takes the entries from the form on the webpage      #
#     and then emails them to you, after checking required fields.   #
#                                                                    #
#                                ;)                                  #
######################################################################
#                           OK, HERE IT IS                           #
#                                                                    #
# File By File:
     1) form_mail.cgi:
            It has the following 9 variables that need setting.
            
	     $SENDMAIL = ##  The Path to your send mail
	    
	     $SUBJECT  = ## This is the default subject for email sent to you from the form. 
	                 ## You can send a subject from your form to override this one.
	                 ##   Allowing for multiple forms with specific subjects
	                 ## (see additional info below about form_mail.html)
	                  
	    
	     $sendto = ## The Email you want the form info to be sent to
	    
	    
	     $ERRORPAGE = ## Path to An error page for invalid entries in the form 
	                  ## See explanation below
	    
	     $THANKSPAGE = ## Path to A Thank you page
	                   ##to be directed to if form is sent sucessfully
	    
	     $SEND_THANKYOU = ## SEND AN EMAIL TO THE PERSON FILLING OUT THE FORM (Y OR N)
	                      ## If 'Y' the plugin send a thank you email
	    
	     $from_email = ## IF $SEND_THANKYOU is 'Y'
	                   ##This is the from address for the email sent
	    
	     $THANKYOU_EMAIL = ## A text file with the content for the $SEND_THANKYOU email
	       
	    
             $VALID_DOMAIN = ## $VALID_DOMAIN if set is where the script can be called from. 
	                     ## If your site responds with or without the "www"
	                     ## leave off the www!
	                     
            Make sure the first line points to Perl on your server
            
            Place in same folder as perlshop and set permissions(755)
            
            Feel free to change the subroutine SEND_MAIL
            so you recieve a more descriptive email
            
     2) error.html:
            This is an error page that the script will open and
             print, inserting an error message stating what is
             wrong(i.e.-mising required fields,bad email).
             
             You can make your own error page or 
             use the one I have included.
             The only REQUIREMENT is you must
             have this comment <!--errormark--> where you want 
             the error message to appear in your page.
             <!--errormark--> NEEDS TO BE ON ITS OWN LINE
             
             View source in error.html to see how its done.
             
     3) thanks.html:
            This is a thank you page that you want the user to 
            be directed to when successfully completing the form
            
     4) thanks_email.txt:
            This is a text file for the email message 
            sent to the user after form completion.
            
     5) form_mail.html:
            I have included a sample html page with a form.
            If you make your own form, the REQUIRMENTS  are
            the input tags must be named plugin_param1,
                                         plugin_param2,
                                         and so on ..
            There are 10 tags total.
            Number 10 is RESERVED for use by the plugin 
                                             its VALUE= is used to tell the plugin 
                                             which fields are the required fields
                                             and email field(if used).
             
             The syntax for plugin_param10 is as follows
             
             TYPE is HIDDEN
             
             VALUE is :
             The param number and a NAME you would like displayed if there is an error
             The number and name need to be separated by a colon(:)
             (i.e. - "1:Name") 
             For multiple required  fields just separate by a comma
             (i.e.- "1:Name,2:email")
             
             If you have an email field the NAME must be "email"
             (if used - plugin checks syntax,treats it as required)
             
             If you want to override the default subject for emails sent to you
             add it to plugin_param10 like you would for email but use the NAME "subject"
             (if used - plugin treats it as required)
             
             
             Here is an example where field 1,2,6 are required and 3 is subject
             and field 2 is an email field) 
             
            <INPUT NAME="plugin_param10" TYPE="HIDDEN" VALUE="1:Name,2:email,3:subject,6:Your Message">
    
             You must send all 10 parameters
             If you dont use all 10 make the ones you dont use
             hidden and without a value. For example
             
             <INPUT NAME="plugin_param7" TYPE="HIDDEN" VALUE="">
	     <INPUT NAME="plugin_param8" TYPE="HIDDEN" VALUE="">
             <INPUT NAME="plugin_param9" TYPE="HIDDEN" VALUE="">
             
######################################################################             
#                                                                    #
#  You will also need to add the script to the ps.cfg file in the    #
#     area that SAYS:                                                #
######################################################################
                                                                     
# Plugin modules.  See the external documentation for details.
%plugins =
(
	# Calendar example plugin
	'calendar'  => 
	{
		'program'	=> 'ps_plugin_gencal.pl'
	}
######################################################################
# Add the form_mail plugin as follows:                               #
######################################################################

# Plugin modules.  See the external documentation for details.
%plugins =
(
	# Calendar example plugin
	'calendar'  => 
	{
		'program'	=> 'ps_plugin_gencal.pl'
	},

	'form_mail'	=> 
	{
		'program'	=>	'form_mail.cgi'
	}
);


######################################################################
#                                                                    #
#                         Thats all,                                 #
#    just refer to your for_mail.html like any other catalog page    #
#                 Any suggestions for a plugin?                      #
#              Email me - chris_jacobs_nj@yahoo.com                  #
#                                                                    #
######################################################################