Author Topic: HTML mail not displaying in RC  (Read 5275 times)

Offline smoothman36

  • Newbie
  • *
  • Posts: 2
HTML mail not displaying in RC
« on: June 02, 2010, 02:57:21 PM »
Hello RC members,

I've set up a html mail that is send from an online emailform. Everything works fine when it is received in hotmail and gmail. Only when I open the message from the inbox in RC its displayed as text and doesnt has a HTML file...

The "show html" button is on and if I forward the hotmail mail to RC THEN it shows that it is an html message.

Can you review the .php mail code, so I can hopefully receive the mail as html in RC.

Thank you in advance!

CODE:
Code: [Select]
<?PHP
global $_POST;
$naam = $_POST[&quot;naam&quot;] ;
$email = $_POST[&quot;email&quot;];
$to = &quot;mail@...&quot;;
$subject = &quot;Title of the mail&quot;;
$mailheader = &quot;From: &quot;.$_POST[&quot;email&quot;].&quot;\r\n&quot;;
$mailheader .= &quot;Reply-To: &quot;.$_POST[&quot;email&quot;].&quot;\r\n&quot;;
$mailheader .= &quot;Content-type: text/html; charset=iso-8859-1\r\n&quot;;
$message = &quot;<html>
<head>
</head>
<body>
<table width='450' border='0' cellspacing='2' cellpadding='8'>
<tr>
<td width='98' bgcolor='#006699'><strong><font color='#FFFFFF' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Naam:</font></strong></td>
<td colspan='4' bgcolor='#F2F2F2'>$naam</td>
</tr>
<tr>
<td width='98' bgcolor='#006699'><strong><font color='#FFFFFF' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Email:</font></strong></td>
<td colspan='4' bgcolor='#F2F2F2'>$email</td>
</tr>

</table>

</body>
</html>&quot;;

header(&quot;Location: http://www....succes message&quot;);
mail($to,$subject,$message,$mailheader,&quot;MIME-Version: 1.0\n&quot; .
&quot;Content-type: text/html; charset=iso-8859-1&quot;);
?>  

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
HTML mail not displaying in RC
« Reply #1 on: June 02, 2010, 09:32:32 PM »
Your code as a couple of problem, one of the main ones is your redirecting the user before the mail is sent. I cleaned up the code and its working for me.


<?php
$naam 
$_POST["naam"];
$email $_POST["email"];
$to "mail@...";
$subject "Title of the mail";
$mailheader "From: "$email ."\r\n"
$mailheader .= "Reply-To: "$email ."\r\n";
$mailheader .= "MIME-Version: 1.0\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$message "<html>
<head>
</head>
<body>
<table width='450' border='0' cellspacing='2' cellpadding='8'>
<tr> 
<td width='98' bgcolor='#006699'><strong><font color='#FFFFFF' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Naam:</font></strong></td>
<td colspan='4' bgcolor='#F2F2F2'>
$naam</td>
</tr>
<tr> 
<td width='98' bgcolor='#006699'><strong><font color='#FFFFFF' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Email:</font></strong></td>
<td colspan='4' bgcolor='#F2F2F2'>
$email</td>
</tr>

</table>

</body>
</html>"
;


mail($to,$subject,$message,$mailheader);
header("Location: http://www....succes message");
?>

Offline smoothman36

  • Newbie
  • *
  • Posts: 2
Thanx
« Reply #2 on: June 03, 2010, 06:19:35 AM »
Thank you so much for the quick help. Looks much better & works much better ;)

Thanks again!