Php 如何将从数据库检索到的网页作为电子邮件发送到多个电子邮件

Php 如何将从数据库检索到的网页作为电子邮件发送到多个电子邮件,php,mysql,sql,forms,email,Php,Mysql,Sql,Forms,Email,我有一个注册页面,注册后,表格将生成给申请人(包含每个申请人填写的所有表格字段),我从数据库中检索到了这些表格,现在我希望生成的表格以邮件形式发送给多个电子邮件(由申请人在注册期间提供)。 这是表单检索及其响应的代码,我只想将此页面作为邮件发送到多个电子邮件,如我上面所述。 多谢各位 <?php $query = ""; include("includes/connect.php"); ?> <?php if(isset($_GET['name1'])) { $sql

我有一个注册页面,注册后,表格将生成给申请人(包含每个申请人填写的所有表格字段),我从数据库中检索到了这些表格,现在我希望生成的表格以邮件形式发送给多个电子邮件(由申请人在注册期间提供)。 这是表单检索及其响应的代码,我只想将此页面作为邮件发送到多个电子邮件,如我上面所述。 多谢各位

    <?php 
$query = "";
include("includes/connect.php");
?>
<?php
if(isset($_GET['name1'])) {
$sql = "SELECT *FROM intern_form WHERE unique_no='".$_GET['name1']."';";
$row = mysql_fetch_array(mysql_query($sql));
}
?>

<p>The Registrar,</p>
<p><?php echo $row['institution']; ?></p>
<p><?php echo $row['institution_address']; ?></p>
<p align="center"><strong>RE: APPLICATION FOR <?php echo    $row['it_duration']; ?> INDUSTRIAL TRAINING:</strong></p>

RE:工业培训申请:

尊敬的先生/女士:

兹通知您,上述学生已被接受参加工业实习。

我在此确认,我们将能够在我们的董事会(项目)中提供工业培训。

请在附件中查找随附的工作时间表。

谢谢。

您诚挚的,

签名




可能重复:首先,不要使用
mysql
-切换到其他更安全的东西,如
mysqli
可能重复:首先,不要使用
mysql
-切换到其他更安全的东西,如
mysqli
,我非常感谢您的回复,但将发送到的电子邮件不是静态的,它将是静态的不同的申请者会有所不同,因此我如何声明数据库中电子邮件的变量。@ibrahim告诉我您的地址是如何存储在数据库中的?@ibrahim您需要将电子邮件放入数组,然后使用类似于
$to=内爆(',,,$emails\u数组)的内容
非常感谢您的回复,但是发送到的电子邮件不是静态的,它将来自数据库,并且会因申请者的不同而有所不同,因此如何声明数据库中电子邮件的变量。@ibrahim告诉我您的地址如何存储在数据库中?@ibrahim您需要将电子邮件放入数组中,然后类似这样的se
$to=内爆(',',$emails\u数组);
<?php
// send to multiple emails
$to  = 'friend1@example.com' . ', '; // first
$to .= 'friend2@example.com' . ', '; // second and other (with .=)


$subject = "Thanks for register";
$message = '
<html>
    <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Thanks for register</title>
    </head>
    <body>
        <p>Dear Sir/Ma,</p>
        <br>
        <p>This is to inform you that the above named student has been accepted for <p>industrial attachment.</p>
        <br>
        <p>I hereby comfirm that we would be in a position to offer Industrial Training in our Directorate(ITeMS).</p>
        <br>
        <p>Please find attached schedule of duty during the attachment.</p>
        <br>
        <p>Thank You.</p>
        <p>Yours faithfully,</p>
        <p>Signature</p>
    </body>
</html>';


$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= "Content-type: text/html; charset=utf-8 \r\n";


$headers .= "From: yournick <yournick@example.com>\r\n";
$headers .= 'Cc: secondnick@example.com' . "\r\n"; // if you want to send a copy to yourself or anybody

mail($to, $subject, $message, $headers);
?>