Issue with html content-type header when sending an php smtp mail through PEAR
I can send emails perfectly but they are showing on plain text, I have been trying a lot of solutions to display it as HTML trying to put content-type but when I check the headers from the email sent MIME and Content-type headers are missing. What I am doing wrong?
$email = "email@example.com"; $subject = "example subject\r\n"; $msg_body = "example body with some html"; $host = "mail.examplehost.com"; $username = "firstname.lastname@example.org"; $password = "examplepass"; $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $headers = array ('From' => "exampledomain.com", 'To' => $to, 'Subject' => $subject 'MIME-Version' => "1.0", 'Content-type' => "text/html; charset=iso-8859-1" ); $mail = $smtp->send($to,$headers,$msg_body);
In the headers array, you seem to be missing a comma after $subject