Search code examples
phpemailheadermime

php email headers with MIME-Version: 1.0


I have these lines of code:

        $from = "email@domian.com";
        $headers = "From:" . $from;
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

I need the MIME type because I am using file_get_contents for an html file, my problem is under the headers it displays as "email@domain.comMIME-Version:1.0" and I want it just to say "email@domain.com" how do I take out the MIME type in the from displaying in the header?

Thanks


Solution

  • Just add \r\n after the From: header as well.

    $headers = "From:" . $from . "\r\n";