douba1067 2016-09-27 04:06
浏览 130

无法连接到“localhost”端口587上的邮件服务器,验证php.ini中的“SMTP”和“smtp_port”设置或使用wamp服务器中的ini_set()

i am using simple send email in php and get this error

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 587, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in

<?php
//if "email" variable is filled out, send email
  if (isset($_REQUEST['email']))  {

  //Email information
  $admin_email = "Silicon.abhishekp@gmail.com";
  $email = $_REQUEST['email'];
  $subject = $_REQUEST['subject'];
  $comment = $_REQUEST['comment'];

  //send email
  mail($admin_email, "$subject", $comment, "From:" . $email);

  //Email response
  echo "Thank you for contacting us!";
  }

  //if "email" variable is not filled out, display the form
  else  {
?>

 <form method="post">
  Email: <input name="email" type="text" /><br />
  Subject: <input name="subject" type="text" /><br />
  Message:<br />
  <textarea name="comment" rows="15" cols="40"></textarea><br />
  <input type="submit" value="Submit" />
  </form>

<?php
  }
?>
  • 写回答

1条回答 默认 最新

  • dtll2016 2016-09-27 04:11
    关注

    SMTP server is required for sending emails. You need to mention SMTP host and SMTP port in php.ini file. If your config is proper then the mail function will work. There are various SMTP servers are available. You can search for them.

    评论

报告相同问题?

悬赏问题

  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒