problem with sending email with php

the problem is that i send my email with headers, subject and content on right address , but everything seems to be in email mixed up.
here is my code:
$headers  = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
      $headers .= 'From: '.$settings_extension['sumbit_email'].'' . "\r\n";
      $subject = "THE PROBLEM";
    $content = "<br><br>";
         mail("", $subject , $content , $headers);
everything comes like html, it shows no newline , it shows <br><br> tags in email
how can i fix this
hest regards
Who is Participating?
hernst42Connect With a Mentor Commented:
use a class which encodes everything correctly like:
MikkkConnect With a Mentor Commented:
This is the way I do it and works fine (be carefull to fill all variables ($from,$text...) as you wish:

$uid = strtoupper(md5(uniqid(time())));
$header = "From: \"Me\" <>\nReply-To: $from\n";
if ($bcc!="") $header .= "Bcc: $bcc\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: multipart/mixed; \n      boundary=$uid\n";

$body .= "--$uid\n";
$body .= "Content-Type: text/html\n";
$body .= "Content-Transfer-Encoding: 8bit\n\n";
$body .= "$text\n";

$body .= "--$uid\n";

mail($to, $subject, $body, $header);
galic1987Author Commented:
it seems that i needed only to delete the "\r" because of server settings
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.