views:

38

answers:

3

I have a simple table:

<table cellpadding="0" cellspacing="0" style="width:600px">
  <tr>
    <td style="width:100px; padding:5px; border:1px solid #444">E-mail</td>
    <td style="width:500px; padding:5px; border:1px solid #444">[email protected]</td>
  </tr>
  <tr>
    <td style="width:100px; padding:5px; border:1px solid #444">Message</td>
    <td style="width:500px; padding:5px; border:1px solid #444">sometext</td>
  </tr>
</table>

When I test it, it looks fine: alt text

When I send it through PHP mail() function, it looks like this: alt text

Why is that margin there?

Just in case, my mail() headers are:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
+1  A: 

The width of your table is 600px.

The width of the cells adds up as follows:

First cell: 1px border + 5px padding + 100px width + 5px padding + 1px border = 112px Second cell 1px border + 5px padding + 500px width + 5px padding + 1px border = 512px

Total width: 624px in a 600px width table.

This may not be the problem, but I bet it is not helping.

I suggest you correct this first and then see what happens.

Mark Chorley
Thanks, good point!
Jevgeni Bogatyrjov
A: 

did you by any chance insert \n\r between the rows in mail()?

netrox
A: 

Well, figured it out - the problem was that I did nl2br($message) before sending. ($message contains the above HTML code)

But thank you all for participation!

Jevgeni Bogatyrjov