= 4.1.2!
# 2) This script expects its name to be "email_basic.php".
# 3) Your "mail" function settings must be set properly! This program uses the
#php "mail" function, which requires the use of sendmail (on Unix) and SMTP (on Windows)!
# 4) You should have a directory specified where php stores file
#attachments temporarily. When this script terminates, the attachments
#should be automatically deleted from your system.
#
#ADDITIONAL FEATURES:
# 1) Dynamically specify the "subject" field through the query string. For example:
#http://www.yourdomain.com/cgi-bin/email_advanced.php?subject=hello_world
#will cause the phrase "hello_world" to automatically show up as the subject for the email
# 2) Dynamically specify the "to" field through the query string. For example:
#http://www.yourdomain.com/cgi-bin/email_advanced.php?to=someone@somewhere.com
#will cause the email to override the default destination address. Great feature if you need
#to send a certain form submittal to another email address
# 3) Dynamically specify the "from" field through the query string. For example:
#http://www.yourdomain.com/cgi-bin/email_advanced.php?from=webmaster@thiscomputer.com
#will cause the email to override the default from address. Great feature if you want
#the email to come "from" another email address
# 4) Any combination of the above. For example:
#http://www.yourdomain.com/cgi-bin/email_advanced.php?subject=hello&from=webmaster@thiscomputer.com
# 5) Multiple file attachments. The ability to add multiple file attachments instead of just one
# 6) Limit the file upload size. Can specify if there are any limitations to the file upload size, and
#if so, how big the allowed files are to be.
# 7) Style sheets. The ability to set (or link in) style sheet definitions to customize your
#HTML text to look like it does on the rest of your site!
# 8) Restrict file uploads by file type! Choose which extensions you want to allow to be uploaded!
#
####
# If you want any of these additional features, you need to purchase the "advanced" version
#of this email script. Go to http://www.davelozinski.com/scripts/email for the juicy details. :)
####
#
# Finally, this "basic" code is free, and comes with absolutely NO
#warranties, either expressed or implied. Feel free to do what you want
#with it. Feel free to build upon it. If you did not get this code
#from http://www.davelozinski.com, you don't have the original.
#
#REVISION HISTORY:
# 06/19/05 Version 1.41 Fixed variable warnings when values not supplied.
# 02/14/03 Version 1.4 Updated to work PHP 4.1.2 or later only.
# 05/21/02 Version 1.32 Resolved an issue in the "to" field causing some people to
# receive multiple emails with each mailing. Optimized code a bit more.
# 04/25/02 Version 1.3 - no modifications
# 02/18/02 Version 1.21- Changed the attachment lable so it prints actual file name
# 02/01/02 Version 1.2 - Minor modifications
# 09/28/01 Version 1.1
# 08/01/01 Original Version
#
#CONTACT INFORMATION:
# http://www.davelozinski.com/cgi-bin/email_lozinski.pl
#
#Begin the customizable configurations:
#The title of the web page and the text on the "submit" button
$TITLE = "Send Me Email!";
#The background color of the web page, the normal text color, and the
#text color for the information that is required. Note that these can
#either be in hexidecimal format, or words as the settings below show.
#If you specify the color code in hex, it expects a leading '#'
#pound sign.
$BGCOLOR = "#000000";
$TEXT_COLOR_NORMAL = "#0088FF";
$REQUIRED_TEXT_COLOR = "yellow";
#The URL to a background picture for the web pages.
$BACKGROUND_URL = "";
#The URL to the executable directory where this script is located.
#DO NOT put a trailing slash '/' character!
$CGI_DIR = ".";
#Set to "1" if you want the optional fields shown in the email form.
#Set to "0" (zero) otherwise.
$SHOW_OPTIONAL_FIELDS = 1;
#The email address where you want all the email from this page sent to if
#no destination email is supplied by the "to" parameter.
$DESTINATION_EMAIL = "destination@your_domain.com";
#The email address that will be placed in the "from" field of all emails sent back to
#the end user.
$FROM_EMAIL = "from_email@yourdomain.com";
#Set to "1" if you want the optional file upload field shown in the email form.
#Set to "0" (zero) otherwise.
#BE CAREFUL WHEN USING THIS FEATURE AS PEOPLE COULD POTENTIALLY EMAIL YOU
#VIRUSES! Of course, this is true of any email you receive, but allowing
#email attachments from strangers greatly increases this risk.
#
$SHOW_ATTACHMENT_FIELD = 1;
#####################################################################
######## NOTHING FROM HERE DOWN SHOULD NEED TO BE CONFIGURED ########
#####################################################################
#These are set up here in case the PHP developers decide to screw
#everyone over again by changing variable names, introducing new
#variables, completely changing PHP configuration files, or doing
#something else for future releases.
#########
if (array_key_exists ("mail", $_REQUEST)) { $mail = $_REQUEST["mail"]; } else { $mail = ""; }
if (array_key_exists ("subject", $_REQUEST)) { $subject = $_REQUEST["subject"]; } else { $subject = ""; }
if (array_key_exists ("message", $_REQUEST)) { $message = $_REQUEST["message"]; } else { $message = ""; }
if (array_key_exists ("users_name", $_REQUEST)) { $users_name = $_REQUEST["users_name"]; } else { $users_name = ""; }
if (array_key_exists ("users_email", $_REQUEST)) { $users_email = $_REQUEST["users_email"]; } else { $users_email = ""; }
if (array_key_exists ("users_country", $_REQUEST)) { $users_country = $_REQUEST["users_country"]; } else { $users_country = ""; }
if (array_key_exists ("state_address", $_REQUEST)) { $state_address = $_REQUEST["state_address"]; } else { $state_address = ""; }
if (array_key_exists ("attach_name", $_REQUEST)) { $attach_name = $_REQUEST["attach_name"]; } else { $attach_name = ""; }
if (array_key_exists ("keep_copy", $_REQUEST)) { $keep_copy = $_REQUEST["keep_copy"]; } else { $keep_copy = ""; }
if (array_key_exists ("attach", $_FILES)) {
$attach_name = $_FILES["attach"]["name"];
$attach_type = $_FILES["attach"]["type"];
$attach_size = $_FILES["attach"]["size"];
$temp_file_name = $_FILES["attach"]["tmp_name"];
}
######## Main body of code ########
StartHTML();
if (!$mail) {
PrintForm();
} else {
if (!(check_form_data())) {
if (send_mail()) {
reply_to_user();
} else {
echo ("Your email was not sent.
\n");
}
}
}
FinishHTML();
######## php functions ########
########################
#function StartHTML
#This function prints the start of the feedback form web page.
########################
function StartHTML() {
global $BGCOLOR, $BACKGROUND_URL, $TITLE, $TEXT_COLOR_NORMAL;
?>