Ahhh the mail blues. I'm sure of a few things. I know my path to my file is correct because I echoed it out. Attempting to allow users to send a word document along with other field information. After I store the file I encode it and give it a boundary. When the mail delivery is sent the user receives the email as at attachment along with the other fields. At the moment I'm getting no attachment and the email just says 'Other project' ?
//mail delivery
//remove any slashes in from of quotes (added by PHP automatically)
$boundary = '-----=' . md5( uniqid ( rand() ) );
$message .= "Content-Type: application/msword; name=\"my attachment\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment; filename=\"".$_FILES["fileToUpload"]["name"]."\"\n\n";
$path = "".$_SERVER['DOCUMENT_ROOT']."/proposals/".$_FILES["fileToUpload"]["name"]."";
$fp = fopen($path, 'r');
do //we loop until there is no data left
{
$data = fread($fp, 8192);
if (strlen($data) == 0) break;
$content .= $data;
} while (true);
$content_encode = chunk_split(base64_encode($content));
$message .= $content_encode . "\n";
$message .= "--" . $boundary . "\n";
$message .= "".$_POST['company']."
name: ".$_POST['name']."
phone: ".$_POST['phone']."
email: ".$_POST['email']."
Completion Date: ".$_POST['completiondate']."
Project Types:
Web Design: ".$_POST['Type_Web Design']."
Db Web Applications: ".$_POST['Type_Database Web Application']."
Podcast: ".$_POST['Type_Podcast']."
E-Newsletter: ".$_POST['Type_E-Newsletter']."
Flash or 3-D Animation: ".$_POST['Type_Flash or 3-D Animation']."
Instructional Design: ".$_POST['Type_Instructional Design']."
Training Video Script: ".$_POST['Type_Training Video Script']."
Training Podcast: ".$_POST['Type_Training Podcast']."
Consulting: ".$_POST['Type_Consulting']."
Other: ".$_POST['Type_Other']."
Other Project: ".$_POST['Type: Otherproj_type']."";
$headers = "From: \"Me\"<me@here.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
mail('example@example.com', 'Say It Digital LLC. - RFP', $message, $headers);