0

我在这里有这段代码:

对于 HTML:

<form action="process.php" method="POST"><br />
<b>Send message to all users:</b>
<br />Subject: <input type="text" name="subject">
<br />Message:<br />
<textarea name="message" ></textarea>
<br>
<input type="Submit">
</form>

对于 PHP:

<?php 

mysql_connect("localhost", "root", "")or die("cannot connect server ");
mysql_select_db("db_cl3")or die("cannot select DB");

$subject = $_POST['subject'];        
$message = $_POST['message'];

$getusers = mysql_query("SELECT * FROM tbl_info");

while($result = mysql_fetch_array($getusers)) { 
$emailaddress = $result['email'];

mail($emailaddress,$subject,$message);

mysql_close();
}
?>

我得到这个错误:

警告:mail():无法在“localhost”端口 25 连接到邮件服务器,验证 php.ini 中的“SMTP”和“smtp_port”设置或在 C:\wamp\www\occc\process.php 中使用 ini_set()在第 14 行

谁能告诉我如何解决这个错误?

提前致谢。

4

1 回答 1

0

you need to use an smtp server, a server with SMTP Services running on it, a mail server of some sort. There are a few mail servers that allow smtp relay, some require authetnication, some don't, it all depends. You can bounce stuff off of google's smtp server, or if your company has one you can use that one as well. Generally it's smtp.servername.com using port 25, but that's not always the case. IIS used to support SMTP server with Windows Server IIS 7 or less, but I think they've phased it out with IIS 8.

于 2013-03-14T20:31:25.160 回答