2011-06-19 76 views
-3

代碼:爲什麼我的郵件不發送,但我配置smtp?

<?php 
$to = "[email protected]"; 
$subject = "Test mail"; 
$message = "Hello! This is a simple email message."; 
$from = "[email protected]"; 
$headers = "From:" . $from; 
mail($to,$subject,$message,$headers); 
echo "Mail Sent."; 
?> 

錯誤:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\mail.php on line 7 Mail Sent.

+0

它已經被[回答](http://stackoverflow.com/questions/2559898/xampp-mail-not-working-with-php-mail-function)。 – Shef

回答

2

你的互聯網服務提供商使用SMTP服務器。

相關問題