Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Problem z brakiem obrazków w mailingu wysłanym przez PhpMailera
Forum PHP.pl > Forum > Przedszkole
northwest
Witam serdecznie,
Mam mały problem z wysyłką maila z phpmailera.... Wysyła maile poprawie (są w załączniku maila obrazki) - ale ich nie wyświetla...
Testuję na gmail, outlook, wp itp...

Mój html wygląda następująco:
  1. <table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
  2. <tr style="height:800px">
  3. <td style="color:#006600; font-size: 14px; width:100%">
  4. <table border="0" cellpadding="0" cellspacing="0" style="background-image: url(cid:tlo); background-repeat: no-repeat; ">
  5. <tr>
  6. <td style="color:white; font-size: 24px; width:100%; font-weight: bold; padding-left: 43px;">
  7. <p>
  8. Szanowny użytkowniku!</p>
  9. </td>
  10. </tr>
  11. </tbody>
  12. </table>
  13. </td>
  14. </tr>
  15. </tbody>
  16.  
  17. <style type="text/css">
  18. body {
  19. background-image: none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; font-family: Open Sans;</style>


kod wysyłki:
  1. require 'lib/phpmailer2/class.phpmailer.php';
  2. require 'lib/phpmailer2/class.smtp.php';
  3. $mail = new PHPMailer();
  4. $mail->isSMTP();
  5. $mail->CharSet="utf-8";
  6. $tytul = "=?utf-8?B?".base64_encode("$tytul")."?=";
  7. //Enable SMTP debugging
  8. // 0 = off (for production use)
  9. // 1 = client messages
  10. // 2 = client and server messages
  11. $mail->SMTPDebug = 0;
  12. //Ask for HTML-friendly debug output
  13. $mail->Debugoutput = 'html';
  14. //Set the hostname of the mail server
  15. $mail->Host = 'poczta.pl';
  16. //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
  17. $mail->Port = 587;
  18. //Set the encryption system to use - ssl (deprecated) or tls
  19. $mail->SMTPSecure = 'tls';
  20. //Whether to use SMTP authentication
  21. $mail->SMTPAuth = true;
  22. //Username to use for SMTP authentication - use full email address for gmail
  23. $mail->Username = "noreply@mail.com.pl";
  24. //Password to use for SMTP authentication
  25. $mail->Password = "haslo";
  26. //Set who the message is to be sent from
  27. $mail->setFrom('noreply@mail.com.pl', 'noreply@mail.com.pl');
  28. //Set an alternative reply-to address
  29. $mail->addReplyTo('noreply@mail.com.pl', 'noreply@mail.com.pl');
  30. //Set who the message is to be sent to
  31. $mail->addAddress("$doo");
  32. //Set the subject line
  33. $mail->Subject = "$tytul";
  34. //Read an HTML message body from an external file, convert referenced images to embedded,
  35. //convert HTML into a basic plain-text alternative body
  36. $mail->MsgHTML("$tresc");
  37. //Replace the plain text body with one created manually
  38. //$mail->AltBody = 'This is a plain-text message body';
  39. //Attach an image file
  40. $mail->addAttachment('../../../images/mail.jpg');
  41. $mail->AddEmbeddedImage('../../../images/mail.jpg','tlo');
  42. $mail->AddEmbeddedImage('../../../images/mail.jpg');
  43. //send the message, check for errors
  44. if (!$mail->send()) {
  45. echo "Mailer Error: " . $mail->ErrorInfo;
  46. } else {
  47. echo "Message sent!";
  48. }



Wie ktoś może dlaczego to nie chce działaćquestionmark.gifsad.gif

Z góry dziękuję za pomoc,
Northwest
jacobson
a nie musisz podac bezezglednej sciezki do obrazka w mailu przypadkiem ?
phpion
Jako ścieżkę do obrazka spróbuj podać pełną ścieżkę absolutną, a nie relatywną z ../.
northwest
tzn obrazki są w załączniku maila.... tylko nie wyświetlają się w podglądzie maila sad.gif ale jako plik są dołączone do maila....

dziwne jest to, że taki kod: <img src="cid:tlo"> powoduje wyświetlenie obrazka.... tylko w stylach, jako tła nie widać go sad.gif
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.