Page 1 of 1

Can't send HTML email from PHP

Posted: Mon Sep 22, 2008 1:10 pm
by karmafunk
I am trying to send email in HTML format using the following code but I receive the following email, with the headers in the body. Any ideas?

Code: Select all

 
        $to      =  "info@lsign.co.uk";
        $from     = $email; 
        
        $subject = '[Contact] : Website Info requested' ;
        
        $msg     = "From : $from 
" . $message;
        ini_set("sendmail_from", $from);
 
        $test = mail($to, $subject, $msg, "From: $from\r\nReply-To: $from\r\nReturn-Path: $from\r\nX-Mailer:PHP/".phpversion()." \n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1" );
 
The email sent:

Reply-To: stevegra2000@hotmail.com X-Mailer:PHP/5.1.6
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
Message-Id: <20080922173254.D040AA4167@server88-208-236-227.lutions.co.uk>
Date: Mon, 22 Sep 2008 18:32:54 +0100 (BST)

From : stev2000@hotmail.com
Text:another test

Tel:07950567366

Re: Can't send HTML email from PHP

Posted: Mon Sep 22, 2008 6:44 pm
by josh
this is a guess, but \r\n is a windows newline, and if the email server is linux or mac it might see that as the end of the headers segment, did you try a plain old "\n" ?