Reply
Php Script - Mailto Form Development
Old 04-17-2007, 07:29 PM Php Script - Mailto Form Development
Junior Talker

Posts: 1
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 ;
?>
Attached Files
File Type: txt photocontest.txt (2.0 KB, 0 views)
aftermathmedia is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Reply     « Reply to Php Script - Mailto Form Development
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11487 seconds with 14 queries