user3706305 user3706305 - 4 months ago 7
PHP Question

sending emails with html doesn't work

I need a help. My script sends e-mails, but ignores html tags. Could anyone help me with this?

My code is here:

$to = "xyz@xxx.com";
$subject = 'Povolenie užívateľa';
$message = '<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
Užívateľ čaká na vaše schválenie.<br>Meno:$meno <br> Priezvisko:$priezvisko <br>
Firma:$firma<br>
E-mail:$email <br> V prípade ak chcete užívateľa povoliť kliknite na tento odkaz:
<a href="http://website.com/povolenie.php?r=$ret&povolenie=1" target="blank">povoliť</a> <br>
Ak ho povoliť nechcete tak kliknite na tento odkaz:
<a href="http://website.com/povolenie.php?r=$ret&povolenie=0" target="blank">zakázať</a>"
</body>
</html>';


$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; Charset=Windows-1250' ."\r\n";
$headers = 'From: XXX<xyz@xyz.com>' . "\r\n" .
"CC: xxx@xxx.com";
mail($to, $subject, $message, $headers);

Answer

Your last header is broken, missing a concatenate (the period).

$headers = 'From: Autorita <autorita@autorita.eu>' . "\r\n" .               
"CC: autorita@autorita.eu";

add the period/dot

$headers .= 'From:...
         ^ right there

do:

$headers .= 'From: Autorita <autorita@autorita.eu>' . "\r\n" .               
"CC: autorita@autorita.eu";
Comments