Page 1 of 1

HTML email

Posted: Sun Jan 02, 2011 8:28 am
by luthar28
Hello, I am trying to send an HTML email (even a multipart would be fine...both text and html).

All my clients read it properly (as html) but some others it's is coming with non-parsed html code (<html><body><h1>This is an email</h1></body></html>). I have spent hours on this and still can't seem to solve the problem.

This is my code, can anyone see anything wrong with it?

Code: Select all

$message = "<html><body><h3>This is your message, ".$FirstName." ".$LastName."</h3>\n ";
$message.= "You have been assigned a Society Number.  Please do not lose this number as you will need it to login.<br> ";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

$headers = 'From: info@prixaurorawards.ca' . "\r\n" .
    'Reply-To: info@prixaurorawards.ca' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
$headers.= 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Send
mail($Email, 'Registration Confirmation', $message, $headers);

Re: HTML email

Posted: Sun Jan 02, 2011 10:55 am
by anantha
i could not see a closing body and html tag?

Re: HTML email

Posted: Sun Jan 02, 2011 11:17 am
by luthar28
anantha wrote:i could not see a closing body and html tag?
Yeah, good catch. Just tried it. Same result though.

Re: HTML email

Posted: Sun Jan 02, 2011 12:01 pm
by social_experiment
luthar28 wrote:All my clients read it properly (as html) but some others it's is coming with non-parsed html code (<html><body><h1>This is an email</h1></body></html>)
Slight confusion here, you say all your clients reads it properly, yet in the next line you say that others doesn't?
Also, you are using this line of code to wrap the message. Maybe you are cutting of the tags at the end.

Code: Select all

<?php $message = wordwrap($message, 70); ?>