如何在 Linux 上使用 PHP 从本地主机发送电子邮件 [英] How to send email from localhost using PHP on Linux

查看:33
本文介绍了如何在 Linux 上使用 PHP 从本地主机发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道要在 Windows 上从本地主机发送电子邮件,您需要在 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 凭据.这里有一个教程.

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.

这篇关于如何在 Linux 上使用 PHP 从本地主机发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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