Code: Select all
$email_body = nl2br(html_entity_decode($_POST['email_body']));
$message = "--mimeBoundary\n"
. "Content-Type: text/html; charset=UTF-8; format=flowed\n"
. "Content-Transfer-Encoding: 8bit\n"
. "<base href=http:// />" . $email_body;
if ($num_attachments != 0) {
$message .= "\n";
while ($row = mysql_fetch_array($attachment_query)) {
$message .= "--mimeBoundary\n"
. "Content-Type: " . $row['ftype'] . "; name=" . $row['fname'] . "\n"
. "Content-Transfer-Encoding: base64\n"
. "Content-Disposition: attachment\n"
. base64_encode($row['fdata']);
}
$message .= "\n" . "--mimeBoundary--";
}
$encoded_subject = "=?UTF-8?B?" . base64_encode($subject) . "?=\n";
$headers = "From: " . $userEmail . "\n"
// . "Cc: " . $cc . "\n"
// . "Bcc: " . $bcc . "\n"
. "Content-Type: multipart/mixed; boundary=\"mimeBoundary\"\n"
. "MIME-Version: 1.0\n"
. "X-Mailer: PHP\n";
mail($to,$encoded_subject,$message,$headers);