问题描述
我正在开发一个 php/c# 项目,这是一个带有 Web 界面的电子邮件服务器,用于管理电子邮件服务器应用程序.
I am working on a php/c# project which is an Email Server with a web interface to manage the Email Server application.
该程序应该可以在 windows 和 linux 上运行,但我主要是在 windows 上进行开发.
The program is supposed to work on windows and linux but I have been mostly doing my development in windows.
我没有在 Linux 中进行测试,但发现了一个可怕的问题.
I've not come onto testing in Linux and have found a horrible problem.
根据我在 Windows PHP 上搜索的内容,您可以选择要使用的 SMTP 服务器,但在 Linux 上您似乎没有此选项,因此当 PHP 发送电子邮件时,它会完全绕过我的程序.
From what I have googled on Windows PHP you can choose an SMTP server that you want to use, but it looks as if on Linux you don't have this option so when PHP sends an email it completely bypasses my program.
有没有办法让 PHP 使用您选择的 SMTP 服务器,我知道您可以使用 PEAR 覆盖 SMTP 设置,但我更希望标准的 PHP 邮件功能可以工作,以便 PHPBB 论坛等其他软件可以发送通过我的 SMTP 服务器而不是默认的 php 邮件发送电子邮件.
Is there a way to make PHP use an SMTP server of your choice, I know you can use PEAR to overrride the SMTP settings but I'd prefer that the standard PHP mail function would work so other software like PHPBB forum would send emails via my SMTP server instead of the default php mail.
这是可能的还是我使用梨的唯一选择?
Is this something that is possible or is my only option to use pear?
推荐答案
您的标准 php 邮件函数只会发送到 php.ini 中定义为 sendmail _path 的任何内容
You standard php mail function will just send to whatever is defined as the sendmail _path in php.ini
这通常是 sendmail -t -i
您需要配置 sendmail 以使用 smtp.
You would need to configure sendmail to use smtp.
FWIW,大多数从 PHP 应用程序发送大量邮件的开发人员都讨厌 mail(),而是使用提供更好的可配置性/可靠性的许多邮件库(或服务)之一.
FWIW, most developer who do a lot of mail sending from PHP apps revile the mail() and instead use one of many mailing libraries (or services) which provide better configurability/reliability.
例如,您可以将 mail 函数通过管道传输到您自己的 PHP 脚本,并在该脚本中使用您想要的任何库来发送邮件(从而保留跨应用程序使用 mail() 函数).
You could for example pipe the mail function to your own PHP script and use whatever library you wanted to in that script in order to do mail sending (and thus preserving the use of mail() function across applications).
这篇关于在 Linux 上使用带有 SMTP 服务器的默认 PHP 邮件功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)