从本地Apache服务器发送邮件 [英] send mail from local apache server

查看:149
本文介绍了从本地Apache服务器发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我知道有一吨这样的问题,但我通过数十人跑,我不能找到一个合适的答案会为我工作。
我想从我的PHP Web应用程序发送电子邮件。

Hi there I know that there is a ton of issues like this but I ran through dozens of them and I cant find a proper answer that would work for me. I want to send emails from my PHP web app.

和我知道这是可能的,因为在几个月前,我有我的系统上这个功能,然后我开始使用XAMPP和特征消失。我想虽然,我回来的时候我的本地服务器,并使用本地的MySQL数据库和类似的东西我用之前,我可以从我的网站发送电子邮件再次应用程序。

And I know that it is possible because in couple of months ago, I had this "feature" on my system, then I started to use xampp and the feature disappeared. I thought though, that when I come back to my local server and will use a local MySQL database and stuff like I used to before, I could send emails from my web apps again.

不过,我从山狮我的Mac更新到小牛(不知道这是否是主要问题),又回到本地的Apache服务器也删除XAMPP。但我仍然不能从我的web应用程序发送电子邮件。

However, i updated my mac from mountain lion to Mavericks (no idea whether this could be the main issue) and went back to local apache server also removing xampp. But I still cant send emails from my web app.

我改变php.ini文件正在使用中,所以我可以使用邮件功能在php.ini文件看起来像这样:

I changed the php.ini file that is in use so i can use the mail feature the php.ini file looks like this:

[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"

请帮助..任何提示,欢迎:)

Please help .. any hints are welcome :)

推荐答案

在特立独行矿默认的php.ini

Mine default php.ini on maverick

[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,并改变了主机名。

A common problem is that a ISP has blocked port 25, for development i have modified the php.ini section mail as below, the smtp port of my mail server changed to port 587 and changed the hostname.

[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

这篇关于从本地Apache服务器发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆