The following script works (almost) just as I want. This project is so near completion with one small problem. In the email message I get the following: "If you can see this MIME then your client doesn't accept MIME types! --jacquie1003"
This is being sent through Novell GroupWise. I have included the mail script and the resulting email. The email arrives with the attachment and everything seems good except that error message. See the message body below.
The users are completing a form with approximately 95 fields. When they submit a validation is done on mandatory fields. If everthing is complete the completed form is presented to them in the same window, a file is created, and the email is created and sent (with the created file as an attachment) to one of five preset recipient groups.
What am I doing wrong in my mail script. Any help would be greatly appreciated. At this point I am not looking to use PEAR, PHPmailer, Zend, etc... unless I absolutely have to.
I apologize in advance for some of the formatting of my cut-and-paste. Thank you in advance
beginning of mail script
<pre>$head_division = $_POST['head_division'];
$category = $_POST['category'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$FilePath = "c:\\temp\esumes\\";
$FileName = $officer_pr . "_" . $inc_number . ".html";
$ResumeFile = $FilePath . $FileName;
$to = $fname . "." . $lname . "@tucsonaz.gov";
$from = $fname . "." . $lname;
$subject = $head_division . " Divsional Resume (Test)";
$bound_text = "jacquie1003";
$bound = "--".$bound_text."
";
$bound_last = "--".$bound_text."--
";
$header ="From: " . $from . "@tucsonaz.gov" . "
";
$header .="MIME-Version: 1.0
";
$header .="Content-Type: multipart/mixed; boundary=\"$bound_text\"";
$message = "If you can see this MIME then your client doesn't accept MIME types!
"
.nl2br($message)
.$bound;
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"
"
."Content-Transfer-Encoding: 7bit
"
."Please see the attached resume file.<br /><br />"
."<strong><u>Incident Summary</u></strong><br />"
."<strong>Case Number:</strong> " . $inc_number . "<br />"
."<strong>Category:</strong> " . $category . "<br />"
."<strong>UCR:</strong> " . $ucr . "<br />"
."<strong>Location:</strong> " . $inc_street . "<br />"
."<strong>Date:</strong> " . $inc_date . "<br />"
."<strong>Time:</strong> " . $inc_time . "<br />"
."<strong>Officer:</strong> " . $officer . " / " . $officer_pr . "<br />"
.nl2br($message)
.$bound;
$file = file_get_contents($ResumeFile);
$message .= "Content-Type: text/html; name=" . $FileName . "
"
."Content-Transfer-Encoding: base64
"
."Content-disposition: attachment; file=" . $ResumeFile . "
"
."
"
.chunk_split(base64_encode($file))
.$bound_last;
mail($to, $subject, $message, $header);
</pre>
end mail script
Email message
Please see the attached resume file.
Incident Summary
Case Number: 0910071139
Category: Matters of Concern COT
UCR: 04.03
Location: 1310 W. Miracle Mile
Date: 10-07-09
Time: 1505
Officer: Smith / 13785
If you can see this MIME then your client doesn't accept MIME types!
--jacquie1003
End of Email