0
<?php
$result    = mysqli_query($con, "SELECT * FROM  cse");
$mail_data = "";
while ($row = mysqli_fetch_array($result)) {
    $Hallticket_No = $row['Hallticket No'];
    $Name          = $row['Name'];
    $Email_ID      = $row['Email-ID'];
    $Jntu          = mysqli_query($con, "SELECT * FROM  `jntu_excelsheet` WHERE A ='$Hallticket_No'");
    $mail_data     = "<html>
        <head></head> <body>
        <table border='1'>
        <tr>
        <th>Hallticket No</th>
        <th>Subject Code</th>
        <th>Subject Name</th>
        <th>Internal Marks</th>
        <th>External Marks</th>
        <th>Total Marks</th>
        <th>Credits<th>
        </tr>";


    while ($x = mysqli_fetch_array($Jntu)) {


        $A         = $x['A'];
        $B         = $x['B'];
        $C         = $x['C'];
        $D         = $x['D'];
        $E         = $x['E'];
        $F         = $x['F'];
        $G         = $x['G'];
        $mail_data = $mail_data . '<tr>';
        $mail_data = $mail_data . '<td>' . $x['A'] . '</td>';
        $mail_data = $mail_data . '<td>' . $x['B'] . '</td>';
        $mail_data = $mail_data . '<td>' . $x['C'] . '</td>';
        $mail_data = $mail_data . '<td>' . $x['D'] . '</td>';
        $mail_data = $mail_data . '<td>' . $x['E'] . '</td>';
        $mail_data = $mail_data . '<td>' . $x['F'] . '</td>';
        $mail_data = $mail_data . '<td>' . $x['G'] . '</td>';
        $mail_data = $mail_data . '</tr>';



    }

    $mail_data = $mail_data . "</table></body></html>";
    // echo $mail_data;
    $x         = mail($Email_ID, "Exam Result", $mail_data);
    if ($x) {
        echo "<div style='color:red'>";
        echo "mail sent..!   " . "<i><span style='color:blue'>" . $Email_ID . "</span></i>";
        echo "</div>";
    } else {
        echo "<div style='color:red'>";
        echo "<br>email not sent To:  " . "<b><span style='color:chocolate'>" . $Email_ID . "</span></b>";
        echo "</div>";
    }

}
?>

我想以如下表格格式发送结果:

Hallticket No Subject_Code Subject_Name Internal_Marks External_Marks Total_Marks Credits
xxx           xxxx         xxx          xxx            xxxxx          xxx
yyyy          yyyyy        yyyy         yyy            yyyyy          yyyy         
4

2 回答 2

1

在电子邮件的标题中将内容类型设置为 text/html。将 html 构建为消息变量并像往常一样发送它。

“内容类型:文本/html”

于 2013-06-28T15:55:23.860 回答
1

您需要设置mail()标题。请参见此处的示例 #4:http: //us1.php.net/manual/en/function.mail.php

于 2013-06-28T15:53:43.943 回答