简体   繁体   English

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

[英]How to configure php.ini file for mail() in MAC OS?

I'm using MAC OS and using mail() to send the student details to my mail. 我正在使用MAC OS并使用mail()将学生详细信息发送到我的邮箱。

It does not shows any errors, but the details are not sent to mail. 它不显示任何错误,但详细信息不会发送到邮件。

Is there any setup in php.ini for SMTP settings? 在php.ini中是否有任何设置用于SMTP设置?

For OSX Yosemite, this fixed me right up: 对于OSX约塞米蒂来说,这解决了我的问题:

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

Ensure that you have your postfix configured - check out this link to learn more: http://benjaminrojas.net/configuring-postfix-to-send-mail-from-mac-os-x-mountain-lion/ 确保您配置了postfix - 请查看此链接以了解更多信息: http//benjaminrojas.net/configuring-postfix-to-send-mail-from-mac-os-x-mountain-lion/

Mac and php's mail - it's simple. Mac和php的邮件 - 很简单。
Check this beautiful article: 看看这篇美丽的文章:
http://theandystratton.com/2009/fix-phps-mail-function-after-latest-os-x-leopard-update http://theandystratton.com/2009/fix-phps-mail-function-after-latest-os-x-leopard-update

You can also use the OS X Server app from the App Store. 您还可以使用App Store中的OS X Server应用程序。 I believe it's free, at least for developers. 我相信它是免费的,至少对开发者来说是这样。 If you turn on the Mail option, it sets up postfix for you. 如果您打开邮件选项,它会为您设置postfix。 You'll need a relay or you'll need your computer to have an established domain; 你需要一个中继,否则你需要你的计算机才能建立一个域名; sending e-mail is easy, but not having it rejected is hard :D 发送电子邮件很容易,但没有被拒绝很难:D

Yes, it says 是的,它说

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

but it seems that this is available on MacOS, too. 但似乎这也适用于MacOS。 For test mails, you can set this to your mail provider's inbound mailserver. 对于测试邮件,您可以将其设置为邮件提供商的入站邮件服务器。 If you want to send real mail from localhost you need a solution that supports SMTP auth, PHPMailer being one of them. 如果您想从localhost发送真实邮件,您需要一个支持SMTP身份验证的解决方案, PHPMailer就是其中之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM