从本地Apache服务器发送邮件

时间:2014-01-15 22:22:49

标签: php apache localserver

我想从我的PHP网络应用发送电子邮件。我知道这是可能的,因为几个月前,我在我的系统上有这个“功能”,然后我开始使用xampp并且该功能消失了。

我想当我回到我的本地服务器并使用本地MySQL数据库以及以前的东西时,我可以再次从我的网络应用程序发送电子邮件。

我将操作系统从Mountain Lion更新为Mavericks(不知道这是否可能是主要问题)并返回本地apache服务器也删除了xampp。但我仍然无法从我的网络应用程序发送电子邮件。

我更改了正在使用的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 = me@example.com

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

1 个答案:

答案 0 :(得分:-1)

特立独行的默认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 = me@example.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

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on NT, not valid in Windows 95).
;mail.log = syslog

一个常见的问题是ISP已阻止端口25,对于开发,我已经修改了php.ini部分邮件,如下所示,我的邮件服务器的smtp端口更改为端口587并更改了主机名。

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.example.net
; http://php.net/smtp-port
smtp_port = 587
sendmail_from = user@example.net
auth_username = user@example.net
auth_password = password
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com
相关问题