首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将从数据库中检索的网页作为电子邮件发送到多个电子邮件

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

Stack Overflow用户
提问于 2016-06-01 05:48:09
回答 1查看 48关注 0票数 1

我有一个注册页面,注册后表格将生成给申请人(包含每个申请人填写的所有表单字段),我从数据库中检索到这些表格,现在我希望将生成的表单作为邮件发送给多封电子邮件(在注册期间由申请人提供)。这是表单检索的代码和它的响应,我只想把这个页面作为邮件发送给多个电子邮件,就像我上面所说的。谢谢。

代码语言:javascript
复制
    <?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>

尊敬的先生/马:

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

我特此声明,我们将能够在我们的董事会(ITeMS)提供工业培训。

请在附件中找到所附的工作时间表。

谢谢。

你忠实的,

签名

EN

回答 1

Stack Overflow用户

发布于 2016-06-01 05:57:58

代码语言:javascript
复制
<?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);
?>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37560382

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档