problem with sending email with php

Posted on 2007-10-18
Last Modified: 2011-04-14
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
Question by:galic1987
    LVL 48

    Accepted Solution

    use a class which encodes everything correctly like:
    LVL 8

    Assisted Solution

    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);

    Author Comment

    it seems that i needed only to delete the "\r" because of server settings

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now