如何设置 Debian Linux 默认发送邮件/发送邮件应用程序/脚本?
我不熟悉 Linux,但我正在尝试从 PHP 发送邮件。通过 SSH,我发现我的服务器的 sendmail
和 mail
功能无法通过 SMTP 发送邮件。但是,我在 nc
(Netcat) 和 telnet
方面取得了成功。有没有办法切换服务器的默认邮件发送应用程序?例如,从 sendmail
或 mail
到 nc
或 telnet
?
I'm unfamiliar with Linux, but I'm trying to send mail from PHP. Via SSH, I've found my server's sendmail
and mail
functions to be incapable of sending mail through SMTP. But, I've had success with nc
(Netcat) and telnet
. Is there a way to switch a server's default mail sending application? E.g. from sendmail
or mail
to nc
or telnet
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
sendmail_path 下的 php.ini 文件中有什么? (可能在 /etc/php5/apache2/php.ini )
例如:
您需要它指向 sendmail 的正确位置,以便 mail() 工作
What's in your php.ini file under sendmail_path? (Probably at /etc/php5/apache2/php.ini)
eg:
You need this to point into the correct location for your sendmail for mail() to work
您是否尝试过使用 PHP 库发送邮件,例如 PHPMailer 或 Swift Mailer,并通过 SMTP 而不是通过
mail()
函数发送邮件?此外,使用这些库,您将能够更轻松地发送更强大的邮件(html、附件)。
而且,这就是您正在寻找的(我认为),您可以查看 sendmail_path php的配置选项来指定您的邮件发送应用程序命令行(似乎您可以在命令中添加一些参数)。
编辑:添加有关 sendmail_path 的信息
Have you tried a PHP library for sending mail, like PHPMailer or Swift Mailer, and send mail via SMTP and not via the
mail()
function?Also, using those libraries you will be able to send more powerful mails (html, attachments) a lot more easily.
And also, and this is what you were looking for (I think), you may take a look to sendmail_path configuration option of php to specify your mail sending application command line (seems you can put some parameters to your command).
edit: added info about sendmail_path