Find Us! 579 Endicott Street North, Laconia, NH 03246
Please use this email form to sumbit
your donation request.
All Fields Are Required
"; // Check for empty fields if(empty($_POST['name']) || empty($_POST['last']) || empty($_POST['email']) || empty($_POST['address']) || empty($_POST['phone']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } // Get all the values from input $name = $_POST['name']; $last = $_POST['last']; $email_address = $_POST['email']; $address = $_POST['address']; $phone = $_POST['phone']; $message = $_POST['message']; // Check the email address if (!eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email_address)) { $errors .= "\n Error: Invalid email address"; } // Now Generate a random string to be used as the boundary marker $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; // Now Store the file information to a variables for easier access $tmp_name = $_FILES['filename']['tmp_name']; $type = $_FILES['filename']['type']; $file_name = $_FILES['filename']['name']; $size = $_FILES['filename']['size']; // Now here we are setting up the message of the mail $message = "\n\n Name: $name $last \n\n Email: $email_address \n\n Address: \n $address \n $line2 \n $city, $state $zip \n\n Phone: $phone \n\n Message: $message \n\n Attached File: $file_name"; // Check if the upload succeded, the file will exist if (file_exists($tmp_name)){ // Check to make sure that it is an uploaded file and not a system file if(is_uploaded_file($tmp_name)){ // Now Open the file for a binary read $file = fopen($tmp_name,'rb'); // Now read the file content into a variable $data = fread($file,filesize($tmp_name)); // close the file fclose($file); // Now we need to encode it and split it into acceptable length lines $data = chunk_split(base64_encode($data)); } // Now we'll build the message headers $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; // Next, we'll build the message body. Note that we insert two dashes in front of the MIME boundary when we use it $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // Now we'll insert a boundary to indicate we're starting the attachment we have to specify the content type, file name, and disposition as an attachment, then add the file content and set another boundary to indicate that the end of the file has been reached $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$file_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; // Thats all.. Now we need to send this mail... :) if (@mail($to, $subject, $message, $headers)) { echo '
Mail Sent successfully.

'; }else { echo '
Unable to send Mail. Please use your browsers back button and try again.

'; } } } ?>


Enter your email address
to receive offers and information exclusive
to club members!

Website design and content ©2010 Weirs Sports Center. All right reserved.