【问题标题】:Not able to send mail using mail function in php无法使用php中的邮件功能发送邮件
【发布时间】:2014-09-11 09:52:32
【问题描述】:

谁能帮我解决我的问题..我无法在 php 中使用 mail() 发送邮件..这是我的代码:

if (isset($_POST["from"])) {
    $from = $_POST["from"]; // sender
    $subject = $_POST["subject"];
    $message = $_POST["message"];
    $message = wordwrap($message, 70);
    mail("test@example.com",$subject,$message,"From: $from\n");
    echo "Thank you for sending us feedback";
}

当我在 localhost 中运行此程序时,输出显示为“感谢您向我们发送反馈”,但在 test@example.com 中没有收到任何邮件。

【问题讨论】:

标签: php


【解决方案1】:

检查您的 php.ini 配置文件并添加邮件服务器配置:

SMTP = server ; mail server 
smtp_port = 25 ; port
sendmail_from = your@email.com ;

或者

使用 PHPMailer https://github.com/PHPMailer/PHPMailer 通过 gmail、yahoo 或任何外部邮件服务器发送。

【讨论】:

  • 我使用 php mailer 得到了它。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-17
  • 2016-02-25
  • 1970-01-01
  • 2011-08-19
相关资源
最近更新 更多