0

您好,我正在尝试使用 PHP mail() 发送电子邮件并收到此错误:

警告:mail() [function.mail]:无法在“localhost”端口 25 连接到邮件服务器,请验证 php.ini 中的“SMTP”和“smtp_port”设置或在 C:\xampp\htdocs\ 中使用 ini_set()第 169 行的滴灌\类\users.class.php

这是我的 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 = artemkller@gmail.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"

发邮件:

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=artemkller@gmail.com
auth_password=hidden
force_sender=artemkller@gmail.com

这有什么问题?

4

1 回答 1

1

尝试将 SMTP 的端口更改为 465。

于 2013-05-01T20:46:09.807 回答