axiom007 Posted October 2, 2007 Share Posted October 2, 2007 I am trying to send a automated email when a customer submits an online form. The form allows them to add an attachment to the email. I have used this script before and it worked fine. but now it will not work. Maybe you guys can see the error in my ways. <?PHP $to = "rteague@axiomcore.com"; $from = $_POST['email']; $subject = "Client Care Cards | New Account"; $fileatt = $_FILES['clientupload']['tmp_name']; $fileatt_type = $_FILES['clientupload']['type']; $fileatt_name = $_FILES['clientupload']['name']; $headers = "From: " .$from; if (is_uploaded_file($fileatt)) { $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $mess = "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" . $mess . "\n\n"; $data = chunk_split(base64_encode($data)); } $mess.= "Name: " . $_POST['name'] . "\n"; $mess.= "Company Name: " . $_POST['company'] . "\n"; $mess.= "Address: " . $_POST['address'] . "\n"; $mess.= "Best time to contact: " . $_POST['contacttime'] . "\n"; $mess.= "Office phone number: " . $_POST['officenumber'] . "\n"; $mess.= "Mobile number: " . $_POST['mobilenumber'] . "\n"; $mess.= "Fax number: " . $_POST['faxnumber'] . "\n"; $mess.= "Birthday: " . $_POST['bdaymonth'] . " " . $_POST['bdayday'] . "\n"; $mess.= "Contact person: " . $_POST['contact'] . "\n"; $mess.= "Business cards with mailings: " . $_POST['businesscards'] . "\n"; $mess.= "How did you hear about us?: " . $_POST['hearabout'] . "\n"; $mess.= "Return address (line 1): " . $_POST['rtline1'] . "\n"; $mess.= "Return address (line 2): " . $_POST['rtline2'] . "\n"; $mess.= "Return address (line 3): " . $_POST['rtline3'] . "\n"; $mess.= "Return address (line 4): " . $_POST['rtline4'] . "\n"; $mess.= "Programs: " . $_POST['circle'] . "\n"; $mess.= " " . $_POST['realtor'] . "\n"; $mess.= " " . $_POST['mortgage'] . "\n"; $mess.= " " . $_POST['bday'] . "\n"; $mess.= "Personalization (line 1): " . $_POST['pline1'] . "\n"; $mess.= "Personalization (line 2): " . $_POST['pline2'] . "\n"; $mess.= "Personalization (line 3): " . $_POST['pline3'] . "\n"; $mess.= "Personalization (line 4): " . $_POST['pline4'] . "\n"; $mess.= "Jan: " . $_POST['jan'] . "\n"; $mess.= "Feb: " . $_POST['feb'] . "\n"; $mess.= "Mar: " . $_POST['mar'] . "\n"; $mess.= "Apr: " . $_POST['apr'] . "\n"; $mess.= "May: " . $_POST['may'] . "\n"; $mess.= "Jun: " . $_POST['jun'] . "\n"; $mess.= "Jul: " . $_POST['jul'] . "\n"; $mess.= "Aug: " . $_POST['aug'] . "\n"; $mess.= "Sep: " . $_POST['sep'] . "\n"; $mess.= "Oct: " . $_POST['oct'] . "\n"; $mess.= "Nov: " . $_POST['nov'] . "\n"; $mess.= "Dec: " . $_POST['dec'] . "\n"; $mess.= "Cardholder name: " . $_POST['cardholder'] . "\n"; $mess.= "Billing address: " . $_POST['billingaddress'] . "\n"; $mess.= "Card type: " . $_POST['cardtype'] . "\n"; $mess.= "Expiration Date: " . $_POST['expmonth'] . "/" . $_POST['expyear'] . "\n"; $mess.= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; $sendmail = mail($to, $subject, $mess, $headers); any help will be appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/71543-automated-email-help/ Share on other sites More sharing options...
trq Posted October 2, 2007 Share Posted October 2, 2007 Define will not work. Quote Link to comment https://forums.phpfreaks.com/topic/71543-automated-email-help/#findComment-360213 Share on other sites More sharing options...
axiom007 Posted October 2, 2007 Author Share Posted October 2, 2007 you are right, will not work is rather ambiguous. The message does not get sent. Quote Link to comment https://forums.phpfreaks.com/topic/71543-automated-email-help/#findComment-360214 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.