Il seguente codice invia un'e-mail correttamente ma per il corpo. Devo mostrare html nel corpo del messaggio e non riesco a farcela. Gli esempi nel web non inviare l'email :(Php mail: come inviare html?
Come posso risolvere il mio codice per inviare l'e-mail con il codice HTML nel corpo?
Grazie una tonnellata!
<?php
$to = '[email protected]';
$subject = 'I need to show html';
$from ='[email protected]';
$body = '<p style=color:red;>This text should be red</p>';
ini_set("sendmail_from", $from);
$headers = "From: " . $from . "\r\nReply-To: " . $from . "";
$headers .= "Content-type: text/html\r\n";
if (mail($to, $subject, $body, $headers)) {
echo("<p>Sent</p>");
} else {
echo("<p>Error...</p>");
}
?>
+1 per domanda che ho avuto modo simile domanda, ma questa discussione risposte IT (provenienti da varie angolazioni) – Sam