Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem przy funkcji mail
Forum PHP.pl > Forum > Przedszkole
Alik
Witam,
mam problem, ponieważ niewiem czemu ale kiedy wysyłam mail ze strony, na web maila przychodzi mi ładnie w HTML ale już na Outlooka przychodzi mi cały kod HTML maila.
Próbowałem wszystkie blokady w Outlooku pozdejmować ale dalej mam to samo.
Kod strony do wysłania mail jest napewno prawidłowy bo pochodzi z manula php.
Myślę że trzeba coś przestawić w Outlooku tylko co?questionmark.gif
Z góry dziękuje za chęć pomocy.
JohnySpot
Mogę się tylko domyślać, ale sprawdź gdzieś dokładniej, czy nie trzeba jakiś dodatkowych nagłówków poustawiać, żeby otlook wiedział, że to HTML. Sprawdź jeszcze w innym kliencie - Thunderbird.

(P.S) albo wrzuć tu skrypt, lub link do phps to pokombinujemy
Alik
Skrypt:

<?php
// multiple recipients
$to = 'marecki@wbs.pl';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>
JohnySpot
Nie wiem czy Ci to coś pomorze:
W dokumentacji php (http://pl2.php.net/manual/pl/ref.mail.php) zwróciłem uwagę na ten kod:

  1. <?php
  2. //add From: header
  3. $headers = "From: webserver@localhostrn";
  4.  
  5. //specify MIME version 1.0
  6. $headers .= "MIME-Version: 1.0rn";
  7.  
  8. //unique boundary
  9. $boundary = uniqid("HTMLDEMO");
  10.  
  11. //tell e-mail client this e-mail contains//alternate versions
  12. $headers .= "Content-Type: multipart/mixed; boundary = $boundaryrnrn";
  13.  
  14. //plain text version of message
  15. $body = "--$boundaryrn" .
  16.  "Content-Type: text/plain; charset=ISO-8859-1rn" .
  17.  "Content-Transfer-Encoding: base64rnrn";
  18. $body .= chunk_split(base64_encode("This is the plain text version!"));
  19.  
  20. //HTML version of message
  21. $body .= "--$boundaryrn" .
  22.  "Content-Type: text/html; charset=ISO-8859-1rn" .
  23.  "Content-Transfer-Encoding: base64rnrn";
  24. $body .= chunk_split(base64_encode("This the <b>HTML</b> version!"));
  25.  
  26. //send message
  27. mail("root@localhost", "An HTML Message", $body, $headers);
  28. ?>


Przyjżyj się temu bliżej

i tu: http://www.phpguru.org/static/htmlMimeMail5.html
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.