Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]wysyłanie e-maila w formacie html, nie działa to końca
Lejto
post
Post #1





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


Napisałem kod wysyłający e-maila w formacie html jednak nie działa on do końca. Otrzymuje taki efekt:
To jest wiadomość wieloczęściowa w formacie MIME.

Kod
       --==Multipart_Boundary_zzz582x          Content-Type: text/plain; charset="iso-8859-2"
       Content-Transfer-Encoding: 7bit

       --==Multipart_Boundary_zzz582x          Content-Type: text/html; charset="iso-8859-2"
       Content-Transfer-Encoding: 7bit

       <html>
       <body>
       <p><b>html</b></p>
       </body>
       </html>

       --==Multipart_Boundary_zzz582x--

pewnie popełniłem jakąś literówkę ;/
zerknijcie na kod:


  1. <?
  2. class mailer {
  3.    
  4.    public $to = "agencik@gmail.com";
  5.    public $to_full = "Temat";
  6.    public $form = "agencik@gmail.com";
  7.    public $forum_full = "Lukasz Ogan";
  8.    public $subject = "Test wiadomości";
  9.    
  10.    
  11.    public $random_hash = "zzz582x";
  12.    
  13.    function send()
  14.    {
  15.        ob_start();
  16.        ?>
  17.        Do: <? echo $this->to_full; ?> < <? echo $this->to; ?>>
  18.        Od: <? echo $this->from_full; ?> < <? echo $this->form; ?>>
  19.        MIME-Version: 1.0
  20.        Content-Type: multipart/alternative;
  21.                boundary="==Multipart_Boundary_<? echo ("$this->random_hash\n"); ?>"
  22.        <?
  23.        $headers = ob_get_clean();
  24.        ob_start();
  25.        ?>
  26.        To jest wiadomość wieloczęściowa w formacie MIME.
  27.        
  28.        --==Multipart_Boundary_<? echo $this->random_hash; ?>
  29.        Content-Type: text/plain; charset="iso-8859-2"
  30.        Content-Transfer-Encoding: 7bit
  31.        
  32.        --==Multipart_Boundary_<? echo $this->random_hash; ?>
  33.        Content-Type: text/html; charset="iso-8859-2"
  34.        Content-Transfer-Encoding: 7bit
  35.        
  36.        <html>
  37.        <body>
  38.        <p><b>html</b></p>
  39.        </body>
  40.        </html>
  41.        
  42.        --==Multipart_Boundary_<? echo $this->random_hash; ?>--
  43.        <?
  44.        $message = ob_get_clean();
  45.        $slij = mail($this->to, $this->subject, $message, $headers);
  46.        echo ($slij ? "Wiadomość wysłano\n" : "Wysłanie wiadomości nie powiodło się \n");
  47.        
  48.    }
  49. }
  50. $mail = new mailer;
  51.  
  52. $mail->send();


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 21.08.2025 - 20:55