function mail_attached($to, $from, $subject, $message, $filename, $headers = '')
{
$unique_sep = md5(uniqid(time()));
$headers .= "From: $from\n";
$headers .= "MIME-Version: 1.0\nContent-Type: multipart/mixed;boundary=\"$unique_sep\";\n";
$headers .= "charset=\"iso-8859-1\"\nContent-Transfer-Encoding:7bit\n\n";
$headers .= "If you are reading this, then your e-mail client does not support MIME.\n";
$headers .= "--$unique_sep\n";
$headers .= "Content-Type: text/html; name=\"" . $filename[0]['filename'] . "\"\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "Content-Disposition: attachment; filename=\"" . $filename[0]['filename'] . "\"\n\n";
echo "The file name1 is $filename[1]['filename']<br>";//DEBUG
$filedata = implode("", file($filename[0]['file']));
$headers .= $filedata . "\n\n";
$headers .= "--$unique_sep--\n";
$headers .= "Content-Type: image/jpg; name=\"" . $filename[1]['filename'] . "\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment; filename=\"" . $filename[1]['filename'] . "\"\n\n";
echo "The file name2 is $filename[1]['filename']<br>";//DEBUG
$filedata = implode("", file($filename[1]['file']));
$headers .= chunk_split(base64_encode($filedata));
$headers .= "--$unique_sep--\n";
mail($to, $subject, $message, $headers);
}
$date = time();
$handle = fopen("./forms/form12b25-" . $date . ".htm", "w+");
if($handle)
{
fwrite($handle, $HTML);
fclose($handle);
$f_array_1 = array('file'=>"./forms/form12b25-" . $date . ".htm",'mimetype'=>"text/plain",'filename'=>"form12b25-" . $date . ".htm");
$f_array_2 = array('file'=>"ballot-checked.jpg",'mimetype'=>"image/jpg",'filename'=>"ballot-checked.jpg");
$file_array = array($f_array_1, $f_array_2);
mail_attached("denewey@gmail.com", "12b25@edgarfilingagent.com", "form12b25 Submission", "form12b25 Submission Generated", $file_array);
Any idea what I've done wrong?

Start a new topic
Add Reply




MultiQuote


| 


