Mail() function trouble.

Some custmers report forms send the emails in plain text and not send html.
Html is showed like code!

Have some idea how fix?
I need mail function send html code too

That’s a problem with their emial clients I think – not all email client support HTML email and sometimes it needs to be turned on

No sr, its trouble with php default configuration on interworx, or something like that, becuase all customers from all servers report this at same time,
Before move sites to interworx, they no have trouble, after move sites from ensim have a long list of customer requesting fix this.

There is no “php default configuration on InterWorx”, because InterWorx has nothing to do with the system PHP, which is what the SiteWorx accounts use. The system PHP is installed either by the distribution or by the server admin (if you compiled your own version of PHP).

http://us3.php.net/manual/en/function.mail.php

Look at “Example 4. Sending HTML email”. Check the mail() code to see if they are setting the content-type header:

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";

Also note that the PHP manual suggests using http://pear.php.net/package/Mail for sending HTML messages.

Socheat

I use that package. Works great and a lot more control over sending emails. I usually create emails that will display plain text if the client doens’t support HTML. You can also attach stuff easily.

<?php

$body=$_POST[“body”];

$to=$_POST[“to”];

$subject=$_POST[“subject”];

$from=$_POST[“from”];

$headers = ‘MIME-Version: 1.0’ . "
";
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . "
";

$headers .= "From: <$from>
";

$headers .= "Reply-To: $from
";

if(mail($to,$subject,$body,$headers))echo “&carga=1&mensaje=El mail ha sido mandado”;

else echo “&carga=0&mensaje=El mail no se ha podido mandar”;

?>

This is onw form used by customer, mails arrival in plain tex and show full header !, this is example.

Content-type: text/html; charset=iso-8859-1
From: <ssss@sss.com>
Reply-To: ssss@sss.com
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on
ns1.************
X-Spam-Level:
X-Spam-Status: No, score=-0.5 required=5.0 tests=ALL_TRUSTED,HTML_00_10,
HTML_MESSAGE,HTML_MIME_NO_HTML_TAG,HTML_SHORT_LENGTH,MIME_HTML_ONLY,
NO_REAL_NAME autolearn=ham version=3.0.2

nombre: nombre y apellido
email: ssss@sss.com
mensaje: comentario

before move to interworx all work perfect, i not figure what is the trouble.

s

i use this example form php manual:

<?php
// multiple recipients
$to = ‘aidan@example.com’ . ', '; // note the comma
$to .= ‘wez@example.com’;

// subject
$subject = ‘Birthday Reminders for August’;

// message
$message = ’
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = ‘MIME-Version: 1.0’ . "
";
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . "
";

// Additional headers
$headers .= ‘To: Mary <mary@example.com>, Kelly <kelly@example.com>’ . "
";
$headers .= ‘From: Birthday Reminder <birthday@example.com>’ . "
";
$headers .= ‘Cc: birthdayarchive@example.com’ . "
";
$headers .= ‘Bcc: birthdaycheck@example.com’ . "
";

// Mail it
mail($to, $subject, $message, $headers);
?>

mail recives its showed in this way:

Content-type: text/html; charset=iso-8859-1
To: Mary <mary@example.com>, Kelly <kelly@example.com>
From: Birthday Reminder <birthday@example.com>
Cc: birthdayarchive@example.com
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on
ns1.**********
X-Spam-Level:
X-Spam-Status: No, score=-1.6 required=5.0 tests=ALL_TRUSTED,HTML_60_70,
HTML_MESSAGE,MIME_HTML_ONLY autolearn=ham version=3.0.2

<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>

spamassasin create the trouble?
how fix?

trouble fixed

[LEFT]I dont really know why not work on the old way, but if somebody have same trouble just use headers in this way:

$headers .= ‘MIME-Version: 1.0’ . "
";
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . "
";
[/LEFT]

Were you on a Windows server previously? If so, that would be why. Windows uses "
" and linux uses "
"…

Nop, i stay on ensim with linux.
For taht reason is very strange.
Anyway its fixed.