如何在 MAC OS 中为 mail() 配置 php.ini 文件?

问题描述 投票:0回答:3

我正在使用 MAC 操作系统并使用 mail() 将学生详细信息发送到我的邮箱。

它没有显示任何错误,但详细信息不会发送到邮件。

php.ini 中是否有 SMTP 设置?

sendmail php
3个回答
11
投票

对于 OSX Yosemite,这解决了我的问题:

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

确保您已配置

postfix
- 请查看此链接以了解更多信息:http://benjaminrojas.net/configuring-postfix-to-send-mail-from-mac-os-x-mountain-lion/


1
投票
sudo nano -w /etc/hostconfig

MAILSERVER=-YES-
sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.org
sudo nano -w /etc/postfix/main.cf

myhostname=my.known.host
# php.ini
sendmail_path = "sendmail -t -i"

来源:http://theandystratton.com/2009/fix-phps-mail-function-after-latest-os-x-leopard-update


0
投票

您还可以使用 App Store 中的 OS X Server 应用程序。我相信它是免费的,至少对开发者来说是这样。如果您打开“邮件”选项,它会为您设置 postfix。您需要一个中继,或者您需要您的计算机有一个已建立的域;发送电子邮件很容易,但不被拒绝就很难了 :D

© www.soinside.com 2019 - 2024. All rights reserved.