2016-03-20 9 views
0

Kann jemand bitte beraten bereits Ich sah online und versucht, alles, was ich denken kann, meine ich nur Klartext E-Mail bekommen ...php smtp ssl html Post nicht arbeiten

E-Mail-Teil arbeitet, ist nur die HTML-Zeug nicht Ich bekomme den $ body (Nachricht) im Rohcode statt im HTML-Format.

Hier ist mein Code:

<?php 
require_once "Mail.php"; 

$from = "Home Calendar <[email protected]>"; 
$to = "Me Yahoo <[email protected]>, Me Gmail <[email protected]>"; 
$subject = "TESTING PHP EMAIL"; 
$body = " 
<html> 
    <head> 
     <title>HTML email</title> 
    </head> 
    <body> 
     <p>This email contains HTML Tags!</p> 
    <table> 
     <tr> 
      <th>Firstname</th> 
      <th>Lastname</th> 
     </tr> 
     <tr> 
      <td>Ricardo</td> 
      <td>Wagemaker</td> 
     </tr> 
    </table> 
    </body> 
</html> 
"; 

$host = "ssl://mail.domain.co.uk"; 
$port = "465"; 
$username = "[email protected]"; 
$password = "password"; 

$headers = array (
     "MIME-Version: 1.0", 
     "Content-type: text/html; charset=ISO-8859-1", 
     'From' => $from, 
     'To' => $to, 
     'Subject' => $subject 
     ); 

$smtp = Mail::factory('smtp', 
    array ('host' => $host, 
    'port' => $port, 
    'auth' => true, 
    'username' => $username, 
    'password' => $password)); 

$mail = $smtp->send($to, $headers, $body, $from, $subject); 

if (PEAR::isError($mail)) { 
    echo("<p>" . $mail->getMessage() . "</p>"); 
    } else { 
    echo("\n\n<p>Message successfully sent!</p>\n\n"); 
    } 
?> 

Vielen Dank

Antwort

0

Well keine Hilfe, aber ich dachte, es endlich heraus, es war alles über die neue Linie „rn“ von meinen Header fehlt ..

Hier ist die Änderung, die funktioniert.

$headers = array (
    'MIME-Version' => '1.0rn', 
    'Content-Type' => "text/html; charset=ISO-8859-1rn", 
    'From' => $from, 
    'To' => $to, 
    'Subject' => $subject 
);