apache 在freebsd中为php mail()指定smtp服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/966907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Specify smtp server for php mail() in freebsd?
提问by Ian
I have two dedicated servers, one of which is configured for sending email out (SPF, DKIM, other domain whitelisting methods, etc). I need to send email from both servers, but I want to send mail from both servers through the server that's been set up for it.
我有两台专用服务器,其中一台配置为发送电子邮件(SPF、DKIM、其他域白名单方法等)。我需要从两台服务器发送电子邮件,但我想通过为其设置的服务器从两台服务器发送邮件。
It doesn't look like I can explicitly set an SMTP server directly in the mail function. Is there a way I can override the value set in php.ini, through .htaccess or something?
看起来我不能直接在邮件功能中显式设置 SMTP 服务器。有没有办法可以通过 .htaccess 或其他方式覆盖 php.ini 中设置的值?
回答by Jordan S. Jones
I would recommend not using the mailcommand and using a pre-built PHP mailing solution. There are 2 great recommendations at the following: Is this the correct way to send email with PHP?
我建议不要使用该mail命令,而是使用预先构建的 PHP 邮件解决方案。以下是 2 个很好的建议:这是使用 PHP 发送电子邮件的正确方法吗?
In using a pre-built solution, you can have all of your mail go to the same server if you choose.
在使用预先构建的解决方案时,您可以选择将所有邮件发送到同一服务器。

