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

时间:2011-11-17 05:27:23

标签: sendmail php

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

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

在php.ini中是否有任何设置用于SMTP设置?

4 个答案:

答案 0 :(得分:9)

对于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 :(得分:3)

Mac和php的邮件 - 很简单。
查看这篇精美的文章:
http://theandystratton.com/2009/fix-phps-mail-function-after-latest-os-x-leopard-update

答案 2 :(得分:0)

是的,它说

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

但似乎这也适用于MacOS。对于测试邮件,您可以将其设置为邮件提供商的入站邮件服务器。如果您想从localhost发送真实邮件,则需要一个支持SMTP身份验证的解决方案,PHPMailer就是其中之一。

答案 3 :(得分:0)

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

相关问题