【问题标题】:how to test php email using WAMP如何使用 WAMP 测试 php 电子邮件
【发布时间】:2011-01-18 00:49:20
【问题描述】:

我安装了 wamp 并将其用作我的测试场。但是我无法测试 PHP mail() 函数,因为它总是会摔倒。

这是可以纠正的吗?

确切消息:

Warning:  mail() [<a href='function.mail'>function.mail</a>]: 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:\wamp\www\functions.php on line 288

我还检查了我的 php.ini 设置,它看起来如下:

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

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

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

; 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 = On

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =

谢谢

【问题讨论】:

  • 你能说得更具体点吗?使用mail() 时是否收到任何错误? “它总是摔倒”对我们程序员没有用。
  • 抱歉,我太懒了。更新了上面的更多信息。

标签: php wamp


【解决方案1】:

您可以使用PHPMailer 指向外部 SMTP 服务器。或者您可以使用简单的script that dumps to a file。同一个话题有couple ofearlier questions,有更多想法。

【讨论】:

    【解决方案2】:

    您必须修改您的 PHP.ini 文件设置以包含 SMTP 服务器、端口和 sendmail_from

    
    [mail function]
    ; For Win32 only.
    ; @987654321@
    SMTP = localhost
    ; @987654322@
    smtp_port = 25
    
    

    ; For Win32 only. ; @987654323@ sendmail_from = you@yourdomain

    【讨论】:

      【解决方案3】:

      安装免费的 argosoft 邮件 argosoft 并在 php 中尝试任何你想要的邮件

      【讨论】:

      • ...快速浏览该页面后,我想我的脑袋已经准备好了!我不得不承认,服务器是我的弱点。我使用 WAMP 是因为在我的笔记本电脑上进行设置非常轻松,无需了解细节。这看起来很复杂,还是我看错了?
      【解决方案4】:

      您还可以将 Gmail 用作 SMTP 服务器,它可以在任何地方、任何服务器、任何操作系统上运行。如果您使用 Google Apps 电子邮件帐户,您甚至可以使用自己的自定义 From: email-address。

      链接:

      示例 PHP 代码:http://deepakssn.blogspot.com/2006/06/gmail-php-send-email-using-php-with.html

      Google Apps:http://www.google.com/apps/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-07-31
        • 2010-12-31
        • 1970-01-01
        • 1970-01-01
        • 2014-06-25
        • 1970-01-01
        • 2012-01-24
        • 1970-01-01
        相关资源
        最近更新 更多