user979331
user979331

Reputation: 11871

php email headers with MIME-Version: 1.0

I have these lines of code:

        $from = "[email protected]";
        $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 protected]:1.0" and I want it just to say "[email protected]" how do I take out the MIME type in the from displaying in the header?

Thanks

Upvotes: 0

Views: 14240

Answers (2)

Hafiz Usman
Hafiz Usman

Reputation: 21

$to = "[email protected]";
$from = "[email protected]";
$subject = "New Agent Record";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "Reply-To: New Agent Record <[email protected]>\r\n"; 
$headers .= "Return-Path:New Agent Record <[email protected]>\r\n";
$headers .= "From: New Agent Record <[email protected]>\r\n";
$headers .= "Organization: Your Email Subject\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";

Upvotes: 2

rid
rid

Reputation: 63482

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

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

Upvotes: 9

Related Questions