如何使用PHP在Linux上从localhost发送电子邮件 [英] How to send email from localhost using PHP on Linux
问题描述
我知道要在Windows上从localhost发送电子邮件,您需要在php.ini中更改SMTP服务器,但这只适用于Windows:
I know that to send e-mail from localhost on Windows, you need to change SMTP server in php.ini however this is valid only on Windows:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
那么我什么应该可以从Linux操作系统发送电子邮件?
So what I should do to be able send e-mails from Linux OS?
推荐答案
我建议安装 ssmtp ,而不是安装完整的邮件服务器,如postfix。如果这只是一个本地的测试环境,你可能不需要一个完整的MTA。 ssmtp 非常容易设置 - 您只需为远程服务器提供smtp凭据。有一个教程 here 。
I would suggest installing ssmtp rather than installing a full mail server like postfix. If this is just a local test environment, you probably don't need a full MTA. ssmtp is very easy to setup--you just supply your smtp credentials for a remote server. There's a tutorial here.
这篇关于如何使用PHP在Linux上从localhost发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!