【发布时间】:2012-03-07 21:49:44
【问题描述】:
大家好,我有一个时事通讯脚本,它将管理员在文本区域中放置的任何内容发送到数据库中的所有电子邮件,现在我希望该用户也能够将 .pdf 文件上传到该电子邮件,非常感谢任何帮助!这是实际发送电子邮件的代码:
Plain 是带有消息的文本区域 主题是主题 需要在验证此脚本的表单上添加上传输入
<?php
include "connect.php";
$subject = stripslashes($_POST["subject"]);
$plain = stripslashes($_POST["plain"]);
$result = mysql_query("SELECT email FROM member");
$emails = array();
while ($row = mysql_fetch_row($result))
$emails[] = $row[0];
$subject = $_POST['subject'];
$from = "noreply@wgtfgb.com";
$headers = "From:" . $from;
$to = implode(", ", $emails);
mail($to, $_POST['subject'], $_POST["plain"], $headers);
?>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>
<form id='register' action='updateprofile.php' method='post' accept-charset='UTF-8'>
<body id="main_body" >
<img id="top" src="top.png" alt="">
<div id="form_container">
<h1>Newsletter Sent</h1>
<form id="form_362567" class="appnitro" method="post" action="">
<div class="form_description">
<h2> Newsletter Sent</h2>
<p></p>
</div>
<ul >
<li class="section_break">
<p></p>
</li> <li id="li_2" >
<label class="description" for="email">
<?php
echo "Newsletter successfully sent, you will be redirected back to the member area in 5 seconds.";
?>
</form>
<div id="footer">
<meta http-equiv="refresh" content="5; URL=index.php">
</div>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>
【问题讨论】:
-
免去你的痛苦,停止使用非常基本的(动力不足且速度慢)的mail()函数
-
我觉得还可以吗?有什么不好的..?这可能吗
-
可能,但该功能的“功能”非常有限,除了发送非常基本的电子邮件,没有人将其用于任何事情
标签: php mysql email attachment