$val) { if (!$val) { $attachments .= "--$boundary$eol" . "Content-Type: " . str_replace("\n", "", $files["type"][$key]) . $eol . "Content-Disposition: attachment; filename=\"" . preg_replace('~["\n]~', '', $files["name"][$key]) . "\"$eol" . "Content-Transfer-Encoding: base64$eol$eol" . chunk_split(base64_encode(file_get_contents($files["tmp_name"][$key])), 76, $eol) . $eol ; } } $beginning = ""; $headers = "Content-Type: text/plain; charset=utf-8$eol" . "Content-Transfer-Encoding: 8bit"; if ($attachments) { $attachments .= "--$boundary--$eol"; $beginning = "--$boundary$eol$headers$eol$eol"; $headers = "Content-Type: multipart/mixed; boundary=\"$boundary\""; } $headers .= $eol . "MIME-Version: 1.0$eol" . "X-Mailer: Adminer Editor" . ($from ? $eol . "From: " . str_replace("\n", "", $from) : "") //! should escape display name ; return mail($email, email_header($subject), $beginning . $message . $attachments, $headers); } /** Check whether the column looks like boolean * @param array single field returned from fields() * @return bool */ function like_bool($field) { return preg_match("~bool|(tinyint|bit)\\(1\\)~", $field["full_type"]); }