我在使用该mail()
函数在 PHP 中发送邮件时遇到一些问题。这是我的php代码
<html>
<body>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
ini_set("SMTP", "ssl://smtp.gmail.com");
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("mr.choudhary_2008@rediff.com",$subject,$message,"From:" .$email);
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='email.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
</body>
</html>
我得到的错误是:
Warning: mail() [function.mail]: Failed to connect to mailserver at "ssl://smtp.gmail.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\email.php on line 14
Thank you for using our mail form