
email - PHP
Ahoj, nevím proč ale nefunguje mi odesílání emailu ze stránky. soubor je .php. Konkrétně teď mi ani tu stránku nenačte, zobrazí ji bílou, jakože je tam někde chyba, ale kde? pomůže mi někdo prosím
<?php
$head = "MIME-Version: 1.0".PHP_EOL;
$head .= "Content-Type: text/html; charset=\"utf-8\"".PHP_EOL;
$head .= "Content-Transfer-Encoding: base64".PHP_EOL;
$predmet = "=?utf-8?B?".base64_encode(autoUTF($predmet))."?=";
"From: =?UTF-8?B?".base64_encode(autoUTF("Moje Jméno"))."?=<ja@email.cz>".PHP_EOL;
$zprava = base64_encode(autoUTF($zprava));
$mail = 'sdhprostrednibecva@centrum.cz';
$predmet = 'ěščřžýáíé46';
$zprava = "Test, \r\n ěščřžýáíé123456789";
if (cs_mail($mail, $predmet, $zprava, "From: sdhbecva@web.cz".PHP_EOL))
{
echo 'E-mail byl úspěšně odeslán.<br>';
}
else
{
echo 'E-mail se bohužel nepodařilo odeslat.<br>';
}
function autoUTF($s)
{
if (preg_match('#[\x80-\x{1FF}\x{2000}-\x{3FFF}]#u', $s)) // detect UTF-8
{
return $s;
}
elseif (preg_match('#[\x7F-\x9F\xBC]#', $s)) // detect WINDOWS-1250
{
return iconv('WINDOWS-1250', 'UTF-8', $s);
}
else // assume ISO-8859-2
{
return iconv('ISO-8859-2', 'UTF-8', $s);
}
}
function cs_mail($to, $predmet, $zprava, $head = "")
{
$predmet = "=?utf-8?B?".base64_encode(autoUTF($predmet))."?=";
$head .= "MIME-Version: 1.0".PHP_EOL;
$head .= "Content-Type: text/plain; charset=\"utf-8\"".PHP_EOL;
$head .= "Content-Transfer-Encoding: base64".PHP_EOL;
$zprava = wordwrap(base64_encode(autoUTF($zprava)), 78, PHP_EOL, true);
return mail($to, $predmet, $zprava, $head);
?>
Funkce cs_mail nemá uzavřenou závorku.