Autor Zpráva
Petra z Votic
Profil
Mám formulář na odeslání emailu - následuje zpracování pomocí PHP. Vše funguje jak má. - příklad

http://svatebni-fotograf.cz/kontakt1.html

Jenže email který odesílám na seznam např. na pokusphp@seznam.cz přijde bez diakritiky a tudíž nečitelný.

Customer name: Ä?Ä?Ä?Ä?Ä?
Customer email: lsd@seznam.cz
Customer comments:
Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?Ä?


Nevíte někdo PLEASE jak to vyřešiti?

Děkuji
Leo
Profil
Bez kodu tezko, Leo
Petra z Votic
Profil
Email se správně odesílá na seznam, ale bez diakritiky.

PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<?

$name=trim($name);
$email=trim($email);
$feedback=trim($feedback);

if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
{
echo "That is not a valid email address. Please return to the"
." previous page and try again.";
exit;
}

$toaddress = "ldic@seznam.cz";


$subject = "Feedback from web site";
$mailcontent = "Customer name: ".$name."\n"
."Customer email: ".$email."\n"
."Customer comments: \n".$feedback."\n";
$fromaddress = "webserver@bobsdomain.com";

mail($toaddress, $subject, $mailcontent, $fromaddress);
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Svatební fotograf. Svatební fotografie, Foto, Focení dětí, Fotografie, Fotografování, Fotograf Praha</title>
<meta name="description" content="Svatební fotograf - svatební foto, focení svateb, svatební fotografie, svatba foto, fotograf svatba, svatby, fotografování svatby, fotograf svateb." />
<meta name="keywords" content="svatební fotograf, foto svatba, svatební fotografie, focení, fotografie, fotograf, fotky, svatby, fotografování" />
<meta http-equiv='imagetoolbar' content='no' />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" media="screen,projection" type="text/css" href="styles/layout.css" />
<link rel="alternate stylesheet" type="text/css" href="styles/nature.css" title="nature" />
<link rel="alternate stylesheet" type="text/css" href="styles/greenworld.css" title="greenworld" />
<link rel="alternate stylesheet" type="text/css" href="styles/beauty.css" title="beauty" />
<link rel="alternate stylesheet" type="text/css" href="styles/roads.css" title="roads" />
<link rel="alternate stylesheet" type="text/css" href="styles/seaworld.css" title="seaworld" />
<link rel="stylesheet" media="print" type="text/css" href="styles/print.css" />
<script language="JavaScript" type="text/JavaScript" src="styles/styleswitcher.js"></script>
</head>

<body>
<div id="container">
<div id="containertop">
<div id="foto"></div>
<div id="top">
<div id="logo"><h1><a title="Na úvodní stránku" href="index.html">Svatební fotograf - svatební foto<span></span></a></h1></div>
<div id="nav"><span class="none">[</span> <a href="index.html">Úvodní stránka</a> <span class="none">] - [</span> <a href="kdo-jsme.html">Kdo jsem</a> <span class="none">] - [</span> <a href="fotogalerie/fotogalerie.html">Fotogalerie</a> <span class="none">] - [</span> <a href="cenik.html">Ceník</a> <span class="none">] - [</span> Kontakt <span class="none">]</span></div>
</div><!-- end top -->
</div><!-- end containertop -->

<div id="break"></div>

<div id="content">
<div id="left">
<div class="head"><h2 class="logo007"><span></span>Svatební fotograf Zdeněk Bursík - svatba foto</h2></div>

<p>Your feedback (shown below) has been sent to <? echo $toaddress; ?></p>
<p><? echo nl2br($mailcontent); ?> </p>
<p>Please tell us what you think.</p>
<form method=post action="processfeedback.php">
Vaše jmno: <br>
<input type=text name="name" size=40><br>
Your email address: <br>
<input type=text name="email" size=40><br>
Your feedback:<br>
<textarea name="feedback" rows=5 cols=30>
</textarea><br>
<input type=submit value="Send feedback">
</form>
</div><!-- end left -->

<div id="right">
<div id="righttext">
<ul id="rightnav">
<li class="rightlitop "></li>
<li><a href="svatebni-foto.html">&nbsp; » Svatební foto</a></li>
<li><a href="fotoreportaz.html">&nbsp; » Fotoreportáž</a></li>
<li><a href="rodinne-foto.html">&nbsp; » Rodinné foto</a></li>
<li><a href="foceni-skoly.html">&nbsp; » Focení škol</a></li>
</ul>
</div><!-- end righttext -->
</div><!-- end right -->
</div><!-- content -->
<div id="footer">
<p class="left">&copy; &nbsp; Fotograf Zdeněk Bursík - Praha, Votice, ČR</p>
<p>tel: 777 851 971 | <a href="mapawebu.html">svatební fotograf - mapa webu</a> | <a href="navod-pouziti.html">ovládání webu</a></p>
</div>
</div><!-- end container -->
</body>
</html>


HTML

<h1>Customer Feedback</h1>

<p>Please tell us what you think.</p>

<form method=post action="processfeedback.php">
Your name: <br>
<input type=text name="name" size=40><br>
Your email address: <br>
<input type=text name="email" size=40><br>
Your feedback:<br>
<textarea name="feedback" rows=5 cols=30>
</textarea><br>
<input type=submit value="Send feedback">
</form>
habendorf
Profil
Petra z Votic:

1) Když chce Leo kód, má na mysli tu podstatnou část, nemusíš to sem dávat celé :o)
2) Prostě ti tam chybí hlavička s kódováním. Zkus

$header = "Content-type: text/plain; charset=utf-8";
mail($toaddress, $subject, $mailcontent, "From: ".$fromaddress."\r\n".$header);
Mistr
Profil
habendorf
tu podstatnou část, nemusíš to sem dávat celé :o)
Sichr je sichr. :-)
eurolike
Profil
habendorf: to tenhle problém myslim zas až tak neřeší :) Ideální je použít nějakou funkci:

function CZMail($to, $subj, $text, $headers = "")
{
// převedení z windows-1250 do iso-8859-2 (pokud je potřeba) $text = StrTr($text,
"\x8A\x8D\x8E\x9A\x9D\x9E",
"\xA9\xAB\xAE\xB9\xBB\xBE");
$subj = StrTr($subj,
"\x8A\x8D\x8E\x9A\x9D\x9E",
"\xA9\xAB\xAE\xB9\xBB\xBE");
// překódování do Base64
$text = Base64_Encode($text);
$subj = "=?iso-8859-2?B?" . Base64_Encode($subj) . "?=";
// přidání hlaviček
if ($headers!="") $headers .= "\n";
$headers .= "MIME-Version: 1.0\n".
"Content-Type: text/plain; charset=\"iso-8859-2\"\n".
"Content-Transfer-Encoding: base64\n";
// odeslání e-mailu
return Mail($to, $subj, $text, $headers);
}
Leo
Profil
"to tenhle problém myslim zas až tak neřeší :) Ideální je použít nějakou funkci"

Kontrolni otazka - k cemu jim bude prekodovani z win1250 do iso-8859-2. kdyz maji stranky v utf-8? Leo
Toto téma je uzamčeno. Odpověď nelze zaslat.

0