Search the Community
Showing results for tags 'doesnt send attachment'.
-
Hi! I'm hoping someone can help me out with a HTML form using PHP. The form allows users to upload a file (and that part works) but it's supposed to attach that file in the email it sends with the form info. I've looked and looked and looked but I haven't been able to find a resolution. HELP!!! <?php $fileName = $_FILES["fileatt"]["name"]; // The file name $fileTmpLoc = $_FILES["fileatt"]["tmp_name"]; // File in the PHP tmp folder $fileType = $_FILES["fileatt"]["type"]; // The type of file it is $fileSize = $_FILES["fileatt"]["size"]; // File size in bytes $fileErrorMsg = $_FILES["fileatt"]["error"]; // 0 for false... and 1 for true move_uploaded_file($fileTmpLoc, "uploads/$fileName"); if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); } $data = chunk_split(base64_encode($data)); $From = $_POST['From']; $Email = $_POST['Email']; $Campaign = $_POST['Campaign']; $Subject = $_POST['Subject']; $email_sub = "Email request confirmation"; $datepicker = $_POST['datepicker']; $Specialty = implode(', ', empty($_POST['Specialty']) ? array() : $_POST['Specialty'] ); $Template = $_POST['Template']; $url = 'http://lwwjournals.com/#calendar'; $Notes = $_POST['Notes']; $formcontent=" New Email Request from $Name \n \n --------------------------------------- \n \n From: $From \n Email: $Email \n Campaign: $Campaign \n Subject: $Subject \n Date: $datepicker \n Specialty: $Specialty \n Template: $Template \n Uploaded File: $fileName \n Notes: $Notes $data"; $formcontent2=" Hey there! Thanks for submitting your request, here's a copy of the information you submitted. \n \n --------------------------------------- \n \n From: $From \n Email: $Email \n Campaign: $Campaign \n Subject: $Subject \n Date: $datepicker \n Specialty: $Specialty \n Uploaded File: $fileName \n Template: $Template \n Notes: $Notes"; $recipient = "email@dummyemail.com"; $subject = "2013 Email Request"; mail($recipient, $subject, $formcontent,'From: emails@lwwjournals.com','-f emails@lwwjournals.com' ) or die("Error!"); mail($Email, $email_sub, $formcontent2,'From: emails@lwwjournals.com','-f emails@lwwjournals.com' ) or die("Error!"); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> index.html mail.php