Hopefully someone can help me out. I would like to add a File Attachment to a MAILTO PHP form script so that when someone fills out our contest form they can attach a specific file and have it attach to the PHP SCRIPT mailto email and be sent to us rather than any uploading to our server.
Any help to get this working would be great!
THIS IS THE HTML PAGE:
http://www.rigragz.ca/photocontest.html
HERE IS OUR (METHOD="POST") PHP SCRIPT THAT WE NEED TO ADD SCRIPT TO (I've also attached it to this thread in a txt file):
<?
// ------------- CONFIGURABLE SECTION ------------------------
// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "
youremailaddress@example.com" ;
$mailto = "
info@aftermathmedia.ca" ;
// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;
$subject = "Via Photo Submission Contest Form" ;
// the pages to be displayed, eg
//$formurl = "
http://www.example.com/feedback.html" ;
//$errorurl = "
http://www.example.com/error.html" ;
//$thankyouurl = "
http://www.example.com/thankyou.html" ;
$formurl = "
http://www.rigragz.ca/photocontest.html" ;
$errorurl = "
http://www.rigragz.ca/error-contest.html" ;
$thankyouurl = "
http://www.rigragz.ca/thankyou-contest.html" ;
$uself = 0;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$address = $_POST['address'] ;
$city = $_POST['city'] ;
$postalcode = $_POST['postalcode'] ;
$email = $_POST['email'] ;
$size = $_POST['size'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($file)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Mailing Address: $address\n" .
"City / Prov.: $city\n" .
"Postal Code: $postalcode\n" .
"Email Address: $email\n" .
"T-Shirt Size: $size\n" .
"\n\n------------------------------------------------------------\n" ;
mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;
?>