Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]problem z polskimi znakami w mailu
BugsBunny
post
Post #1





Grupa: Zarejestrowani
Postów: 206
Pomógł: 4
Dołączył: 2.04.2005

Ostrzeżenie: (0%)
-----


Witam,

naszukałem się trochę po forum wprowadziłem trochę zmian i nadal w mailu mam krzaki zamiast polskich znaków.

  1. <?php
  2. if($_POST['sendMail'])
  3. {
  4.    try
  5.      {
  6.            $Name = Validator::length(30,$_POST['name'],'podpis');
  7.            $subject = "[homepage] ".Validator::length(40,$_POST['topic'],'temat');
  8.          $email = Validator::email($_POST['email']);
  9.          $recipient = "MOJADRES@gmail.com";
  10.          $mail_body = Validator::length(500,$_POST['content'],'treść');
  11.  
  12.      }
  13.    catch(Exception $e)
  14.    {
  15.         $tpl->assign('SendError',$e->GetMessage());
  16.        $Mailerror = true;
  17.        $tpl->assign('oldTopic',$_POST['topic']);
  18.        $tpl->assign('oldEmail',$_POST['email']);
  19.        $tpl->assign('oldContent',$_POST['content']);
  20.        $tpl->assign('oldName',$_POST['name']);
  21.     }
  22.  
  23.      //  to miało pomoc ale nie pomaga
  24.  //    $mail_body = sprintf( "=?utf-8?B?%s?=", base64_encode($mail_body) );
  25. //    $Name = sprintf( "=?utf-8?B?%s?=", base64_encode($Name) );
  26.  
  27.    $header = "MIME-Versio: 1.0r\n"."Content-type: text/html; charset=UTF-8r\n";
  28.    $header .= "From: ". $Name . " <" . $email . ">r\n";
  29.  
  30.    
  31.     if(!$Mailerror)
  32.    {
  33.        $tpl->assign('send',true);
  34.        if(@mail($recipient, $subject, nl2br($mail_body), $header))
  35.        {
  36.             $tpl->assign('result',true);
  37.         }
  38.          else
  39.          {
  40.              $tpl->assign('result',false);
  41.         }
  42.    }
  43.  
  44.  
  45. }
  46. ?>


Ten post edytował BugsBunny 4.10.2008, 11:44:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 14:43