Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wysyłanie wiadomości w html z użyciem MIME, Chodzi mi o zend framework i jego klasy
orideith
post
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 1
Dołączył: 21.07.2006

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


Problem jest taki, że nie wiem jak dodać obrazek w html do wiadomosci z użyciem zenda i szczerze nie moge znaleźć błędu.
Wysyłanie wiadomości wyglada tak.
  1. <?php 
  2. include "library/Zend.php";
  3. date_default_timezone_set('Europe/London');
  4. set_include_path('.' . PATH_SEPARATOR . './library/'. PATH_SEPARATOR . './application/models/'. get_include_path());
  5. Zend::loadClass('Zend_Db');
  6. Zend::loadClass('Zend_Db_Table');
  7. Zend::loadClass('Zend_Mail');
  8.  
  9.  
  10. $mail = new Zend_Mail();
  11. $mail->setFrom('email@domena.pl', 'Nadawca');
  12. $mail->addTo('email1@domena.pl', 'Odbiorca');
  13. $mail->setSubject('Jakis temat');
  14. $myImage = trim(file_get_contents('img/zapytanie.jpg'));
  15. $at = $mail->addAttachment($myImage); 
  16. $at->type = 'image/jpeg'; 
  17. $at->disposition = Zend_Mime::DISPOSITION_INLINE; 
  18. $at->encoding = Zend_Mime::ENCODING_BASE64;
  19. $at->filename = 'zapytanie.jpg'; 
  20.  
  21.  
  22. $msg_time = time();
  23. $at->id = 'part1'.$msg_time.'@domena.pl';
  24. $html_body = '
  25. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  26. <HTML><HEAD>
  27. <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /><title>Temat</title>
  28. <style type="text/css">
  29. body {
  30. margin: 0px;
  31. padding: 0px;
  32. background-color: #fff;
  33. background-repeat: repeat-x;
  34. }
  35. #cn {
  36. text-align: center;
  37. width: 550px;
  38. height: 400px;
  39. margin-left: auto;
  40. margin-right: auto;
  41. margin-top: 20px;
  42. }
  43. </style>
  44. </HEAD>
  45. <BODY><div id="cn"><img src="cid:'.$at->id.'"></div>
  46. </BODY></HTML>';
  47. $mail->setBodyHtml($html_body);
  48. $mail->send();
  49.  
  50. //<BODY background=cid:' . $at->id . '>
  51. ?>


Źródło wiadomości jest takie

  1. <?php
  2. From - Sun Mar 11 23:49:24 2007
  3. X-Account-Key: account4
  4. X-UIDL: 1173652655.2661_2.p12
  5. X-Mozilla-Status: 0001
  6. X-Mozilla-Status2: 10000000
  7. Received: (qmail 2657 invoked from network); 11 Mar 2007 22:37:35 -0000
  8. Received: from unknown (HELO mx1.konta.pl) (85.219.199.247)
  9. by p12.konta.pl with SMTP; 11 Mar 2007 22:37:35 -0000
  10. Received: (qmail 18944 invoked by uid 75); 11 Mar 2007 22:37:35 -0000
  11. Received: from 85.219.199.216 by mx1 (envelope-from <anonymous@p12.konta.pl>, uid 212) with qmail-scanner-2.01 
  12.  (clamdscan: 0.88.2/1429.
  13.  Clear:RC:1(85.219.199.216):. 
  14.  Processed in 0.089185 secs); 11 Mar 2007 22:37:35 -0000
  15. Received: from unknown (HELO p12.konta.pl) (85.219.199.216)
  16. by mx1.konta.pl with SMTP; 11 Mar 2007 22:37:34 -0000
  17. Received: (qmail 2650 invoked by uid 14056); 11 Mar 2007 22:37:33 -0000
  18. Date: 11 Mar 2007 22:37:33 -0000
  19. Message-ID: <20070311223733.2649.qmail@p12.konta.pl>
  20. To: "Odbiorca" <email1@domena.pl>
  21. Subject: Projektowanie stron
  22. From: "Nadawca" <email@domena.pl>
  23. To: "Odbiorca" <email2@domena.pl>
  24. Content-Type: multipart/mixed; charset="iso-8859-2";
  25.  boundary="=_d4945f357189bcc6d5412f1b4a311f1d"
  26. Content-Transfer-Encoding: quoted-printable
  27. Content-Disposition: inline
  28. MIME-Version: 1.0
  29.  
  30.  
  31. --=_d4945f357189bcc6d5412f1b4a311f1d
  32. Content-Type: text/html; charset="iso-8859-2"
  33. Content-Transfer-Encoding: quoted-printable
  34. Content-Disposition: inline
  35.  
  36. =0D=0A<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML=
  37. ><HEAD><meta http-equiv=3D"content-type" content=3D"text/html; charset=3Di=
  38. so-8859-2" /><title>Tytuł</title>=0D=0A<style=
  39.  type=3D"text/css">=0D=0Abody {=0D=0Amargin: 0px;=0D=0Apadding: 0px;=0D=0A=
  40. background-color: #fff;=0D=0Abackground-repeat: repeat-x;=0D=0A}=0D=0A#cn=
  41.  {=0D=0Atext-align: center;=0D=0Awidth: 550px;=0D=0Aheight: 400px;=0D=0Ama=
  42. rgin-left: auto;=0D=0Amargin-right: auto;=0D=0Amargin-top: 20px;=0D=0A}=0D=
  43. =0A</style>=0D=0A</HEAD><BODY><div id=3D"cn"><img src=3D"cid:part111736526=
  44. 52@domena.pl"></div>=0D=0A</BODY></HTML>
  45. --=_d4945f357189bcc6d5412f1b4a311f1d
  46. Content-Type: image/jpeg
  47. Content-Transfer-Encoding: base64
  48. Content-ID: <part11173652652@domena.pl>
  49. Content-Disposition: inline; filename="zapytanie.jpg"
  50.  
  51.  
  52. // plik jpg ciągnie sie trochę ....
  53. /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPwAA/+4ADkFkb2JlAGTAAAAAAf
  54.  
  55. // końcówka
  56. hntY1kv1WWO0zORNGQq+mmXc/F0G5A0B/9k=
  57. --=_d4945f357189bcc6d5412f1b4a311f1d--
  58. ?>



Przepraszam, że takie długie to jest ale nie było inaczej to skrócić.

Podsumowując
Wiadomość dociera , obrazek jest załączony Ale nie wyświetla sie w
<img src=3D"cid:part111736526=
52@domena.pl">

Co jest nie tak bo siedzie nad tym już chyba 4 godziny i przyczyny nie widze.
Pozdrawiam.


zamiast Zenda próbowałem użyć PHPMailera ale jest podobnie w outloku wiadomość tak jak trzeba za to w Thunderbirdzie nie dziala.

Czy to może być wina serwera z, którego wysyłam jeśli tak to gdzie szukać przyczyny ?.
Bede wdzięczny za wszelką pomoc.
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 - 12:48