\n" . "Content-Type: text/plain; charset=\"" . $charset . "\"\n"; } $to = mb_encode_mimeheader($to, $charset, 'Q'); $subject = mb_encode_mimeheader($subject, $charset, 'Q'); $lines = explode("\n", $headers); $i = ''; foreach ($lines as $line) { if (empty($line)) { continue; } if ($line[0] == ' ' || $line[0] == "\t") { $harr[$i] .= ' ' . trim($line); } else { list($i, $value) = explode(':', $line, 2); $i = str_replace(' ', '-', ucwords(str_replace('-', ' ', strtolower($i))) ); $harr[$i] = trim($value); } } foreach (array('From', 'Reply-To') as $h) { if (!empty($harr[$h])) { list($name, $addr) = explode('<', $harr[$h]); $name = trim(str_replace('"', '', $name)); $addr = trim(str_replace('>', '', $addr)); $harr[$h] = '"' . mb_encode_mimeheader($name, $charset, 'Q') . '"' . ' <' . $addr . '>'; } } $headers = ''; foreach ($harr as $hname => $hvalue) { $headers .= $hname . ': ' . $hvalue . "\n"; } return @mail($to, $subject, $message, $headers); } endif; ?>