【问题标题】:send mail() php xampp yahoo发送邮件() php xampp 雅虎
【发布时间】:2013-01-31 03:24:08
【问题描述】:

谁能帮助我? 我坚持使用 PHP mail() 函数,我已经设置了 php.inisendmail.ini。我只是使用函数mail($to,$subject,$content) 并没有工作。我正在使用 localhost XAMPP。

这是php.ini 文件:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.mail.yahoo.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = jesus4way@yahoo.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"

【问题讨论】:

  • 你有什么错误吗?
  • 检查mail() 的返回值以查看电子邮件是否被接受发送。如果true 可能是垃圾邮件过滤器阻止了邮件,如果false 可能是服务器配置。
  • 你使用localhost XAMPP。你安装了SMTP server吗?

标签: php email xampp


【解决方案1】:

检查服务器状态

  • 从 XAMPP 控制面板启动 Mercury Mail Server。检查状态是否为Running
  • 打开 Mercury 控制面板(从 XAMPP 面板或任务栏)并检查 SMTP 服务器状态是否为 Ready
  • 从 Mercury 控制面板向您自己的电子邮件地址发送邮件,并检查是否失败。

PHP

允许错误报告:error_reporting(E_ALL); 并检查 PHP 错误和警告。

尝试将标题信息添加到您的mail() 函数:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>

【讨论】:

  • 我已经使用 murcury 发送了一封测试电子邮件,它很好,但是当我编写 php 代码并对其进行测试时,它对我不起作用
  • 我没有收到任何错误,但是我现在已经用 gmail 配置了它,它工作正常 :)
猜你喜欢
  • 1970-01-01
  • 2023-02-21
  • 1970-01-01
  • 1970-01-01
  • 2012-12-15
  • 2013-09-19
  • 2015-01-08
  • 1970-01-01
  • 2017-12-28
相关资源
最近更新 更多