Hmm, didn't seem to get any replies the first time, but well, I'm still working on this problem. Here's my code for send_submission.php. Any ideas as to what I'm doing wrong?
<?php
$file = "submission.txt";
$warning = "<font color=#808080 size=2 face=arial><center>";
$front = "<font color=#808080 size=2 face=arial><center>";
$end = " <center><BR><a href=javascript:history.go(-1)><font color=#808080 size=2 face=verdana>Go Back</a>
</center></font>";
if($ademail == "you@yourdomain.com") {
echo("$front Software Error: <BR>Invalid Admin Email address. $end");
exit;
}
if($ademail == "") {
echo("$front Software Error: <BR>Invalid Admin Email address. $end");
exit;
}
$contents = fopen($file,"r");
$dacontents = fread($contents, filesize($file));
fclose($contents);
$msg = "$dacontents";
$msg = str_replace("<name>", "$name", $msg);
$msg = str_replace("<email>", "$email", $msg);
$msg = str_replace("<pseudonym>", "$pseudonym", $msg);
$msg = str_replace("<bio>", "$bio", $msg);
$msg = str_replace("<add_info>", "$add_info", $msg);
$mailheaders = "From: $email\n";
$mailheaders .= "Reply-To: $email\n\n";
if($email == "" OR $name == "" OR $bio == "") {
echo("$warning You forgot to fill in the following required fields:<br><br>");
if($name == "") {
echo("$front Name");
}
if($email == "") {
echo("$front Email Address");
}
if($bio == "") {
echo("$front Bio");
}
echo("$end");
exit;
}
// Obtain file upload vars
$fileatt = $FILES['fileatt']['tmp_name'];
$fileatt_type = $FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $email\n";
if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file1 = fopen($fileatt,'rb');
$data = fread($file1,filesize($fileatt));
fclose($file1);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message
$message = "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" .
$message . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
// Add file attachment to the message
$message .= "--{$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";
}
if(!$subject) {
$subject = "Form Submission";
}
mail($ademail,$subject,$msg,$mailheaders,$message);
if($thanks) {
echo header("Location: $thanks");
} else {
echo("<font face=verdana>Thanks!<BR><BR>Here is a result of your feedback:<BR><BR>Sent to: <a
href=mailto:$ademail>$ademail</A><BR>Subject: $subject<BR>Comments: $comments<BR>.");
}
?>