user1811732
user1811732

Reputation: 9

Table does not show row and column borders in email sent using PHP mail

I am using PHP to send mail of a webpage content. I have a table in the page. My table does not show row and column borders in email sent using PHP mail. It does not read the CSS in email. This is my code:

<div id="table_email" style="width:800px;margin-left:50px; text-align: left;">
    <table class="table1">
        <tr>
            <th>Description</th>
            <th colspan="2">Amount</th>
        </tr>
        <tr>
            <td>(A)Package Cost</td>
            <td>';$formatedMessag .= $inv[0].'</td>
        </tr>
        <tr>
            <td>(B) Insurance </td>
            <td>';$formatedMessag .= $inv[1].'</td>
        </tr>
        <tr>
            <td>(C)Flight / Train</td>
            <td>';$formatedMessag .= $inv[2].'</td>
        </tr>
        <tr>
            <td>Add : &emsp;Service Tax 3% on Rs.(a+b)</td>
            <td>';$formatedMessag .=$inv[5].'</td>
        </tr>
        <tr>
            <td>Add : &emsp;Educational Cess 2% On 3% </td>
            <td>';$formatedMessag .= $inv[6].'</td>
        </tr>
        <tr>
            <td>Add : &emsp;Secondary& Higher Education Cess 1% on 3% </td>
            <td>';$formatedMessag .= $inv[7].'</td>
        </tr>
        <tr style=" font-weight: bold;font-size: 12px;background-color:seashell;">
            <td>Total Payable Amount</td>
            <td>';$formatedMessag .='INR ' . $inv[9].'</td>
        </tr>
        ';$formatedMessag .='
    </table>
</div>

This is my CSS:

.table1{
    width: 990px;
    margin-left: 5px;
    border: 1px solid #CDCDCD;
}
.table1 th{
    background: none repeat scroll 0 0 #EEEEEE;
    padding: 10px;
    font-size: 11px;
    color: #777777;
    border: 1px solid #CDCDCD;
}
.table1 tr{
    padding: 10px;
    font-size: 11px;
    height: 30px;
    border: 1px solid #CDCDCD;
}
.table1 tr td:first-child{
    font-weight: bold;
    text-align: left;
    border: 1px solid #CDCDCD;
}
.table1 td{
    padding-left: 3px;
    border: 1px solid #CDCDCD;
    color: #333333;
}

Upvotes: 0

Views: 1893

Answers (1)

Tapas Pal
Tapas Pal

Reputation: 7207

This is because when you sent a mail it can't access the style class, Instead of this <table class="table1"> use inline css like:

<table style='width: 990px; etc;'>.

Upvotes: 1

Related Questions