Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: PEAR >> mail/mime
Forum PHP.pl > Forum > PHP
tptk
witam,

mam problem z kodowaniem wysyłanego maila.....

kod do wysylania maila

  1. <?php
  2. include('Mail.php');
  3. include('Mail/mime.php');
  4. $text = 'wersaj tekstowa...';
  5. $file = 'zlecenie_druk.htm';
  6. $crlf = "rn";
  7. $hdrs = array(  
  8.  
  9. 'Content-Type' => 'text/html; charset="ISO-8859-2"',  
  10. 'From' => 'tomek@srem.pl',
  11. 'Subject' => 'Nowa poczta... '
  12. );
  13. $mime = new Mail_mime($crlf);
  14. $mime->setTXTBody($text);
  15. $mime->setHTMLBody(file_get_contents('zlecenie_druk.htm'));
  16. $mime->addHTMLimage('images/logo.gif');
  17. $mime->addAttachment($file, 'text/plain');
  18. $body = $mime->get();
  19. $hdrs = $mime->headers($hdrs);
  20. $mail =& Mail::factory('mail');
  21. $mail->send('tomek@srem.pl', $hdrs, $body);
  22. ?>


w mailu wysyła sie plik z kodowaniem charset=iso-8859-2

przychodzący mail rowala kodowanie a naglowki wygladja tak:
Date: Sat, 17 Dec 2005 16:45:47 +0100 (CET)
Message-Id: <200512171545.jBHFjl8I056716@fabrykawww.pl>
To: tomek@srem.pl
Subject: Test mime message
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_eeb5bdee5b1e25781a540c042bc669f0"
From: you@yourdomain.com
X-NAS-Language: English
X-NAS-Bayes: #0: 0.567419; #1: 0.432581
X-NAS-Classification: 0
X-NAS-MessageID: 2332
X-NAS-Validation: {52FC1B71-0DA0-4021-84FF-929B5EA0B19B}


--=_eeb5bdee5b1e25781a540c042bc669f0
Content-Type: multipart/alternative;
boundary="=_3534cb5f94ed8aa3e39cf9f10fb1abae"

--=_3534cb5f94ed8aa3e39cf9f10fb1abae
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

Text version of email
--=_3534cb5f94ed8aa3e39cf9f10fb1abae
Content-Type: multipart/related;
boundary="=_5cc710d70c9b5f1d62948a40994305e4"

--=_5cc710d70c9b5f1d62948a40994305e4
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

=B3=F3=BF=B6=E6=F1=B1=F3=B3
--=_5cc710d70c9b5f1d62948a40994305e4
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="logo.gif"
Content-ID: <dea99b5b30af0e67d3bfacf8ae97cb52>

R0lGODlhoAFgAGYAACH5BAAAAAAALAAAAACgAWAAhv///ykIc/XnACoVdCIJbi4NbT8hgRUCaykE

i w rzeczywistości w mailu przychodzą krzaki :-(

Proszę o pomoc... probowalem juz na rozne sposoby ze zmiana kodowania i nic mi nie wyszlo....
NoiseMc
Ja w swoich projektach mam podobny schemat wysyłania do Twojego z tym, że w trochę inny sposób wywołuję metodę Mail_mime::get ();

  1. <?php
  2.  
  3. $arrMailEncoding = array 
  4. ( 
  5. 'html_charset' => 'ISO-8859-2', 
  6. 'text_charset' => 'ISO-8859-2', 
  7. 'head_charset' => 'ISO-8859-2' 
  8. );
  9.  
  10. $mailBody = $objMime->get ( $arrMailEncoding );
  11.  
  12. ?>


Kod
string &get ( array [$param = NULL] )

Cytat
array $param - An associative array of parameters. These parameters affect the way the message is built.

$param["text_encoding"] - Type of encoding to use for the plain text part of the email. Default is "7bit".

$param["html_encoding"] - Type of encoding for the HTML part of the email. Default is "quoted-printable".

$param["7bit_wrap"] - Number of characters after which text is wrapped. SMTP stipulates maximum line length of 1000 characters including CRLF. Default is 998 (CRLF is appended to make up to 1000).

$param["text_charset"] - The character set to use for the plain text part of the email. Default is "iso-8859-1".

$param["html_charset"] - The character set to use for the HTML part of the email. Default is "iso-8859-1".
tptk
Wielki dzieki :-) wlasnie o to mi chodzilo...
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.