[thelist] Sending Tabular data with mail()

Jeffrey Barke jeffrey.barke at themechanism.com
Thu May 22 09:27:20 CDT 2008


Santilal,

PHP's mail function sends a plain text email, not an HTML one, so no  
markup is necessary or will work. Tabular data will probably never be  
perfectly aligned, but your best bet is to use tabs.

So this:
> $body .=           "<tr><td width =
> '120'>$row[1]</td>
>
>                                                                        < 
> td
> width = '120'>$row[2]</td>
>
>                                                                        < 
> td
> width = '60'>$row[3]</td>
>
>                                                                        < 
> td
> width = '60'>$row[4]</td>
>
>                                                                        < 
> td
> width = '120'>$row[5]</td>
>
>                                                                        < 
> td
> width = '120'>$row[6]</td></tr>";

would become:

$body .= "$row[1]\t\t$row[2]\t\t$row[3]\t\t$row[4]\t\t$row[5]\t\t 
$row[6]\n";

Jeffrey



More information about the thelist mailing list