在 CentOS 7 中使用 Sendmail 通过 PHP 发送邮件

摘要: 如果你运行了一个web服务器或者一台VPS,你可能需要在你的PHP程序中发送邮件。FrancescoMondello如果你运行了一个 web 服务器或者一台 VPS ,你可能需要在你的 PHP 程序中发送邮件。 Francesco Mondello安装38%使用 PHP 发送一封测试邮件53%编译自: https://fasterland.net/sendingemailviaphpcentos7...

如果你运行了一个web服务器或者一台VPS,你可能需要在你的PHP程序中发送邮件。FrancescoMondello

如果你运行了一个 web 服务器或者一台 VPS ,你可能需要在你的 PHP 程序中发送邮件。 Francesco Mondello

安装38%

使用 PHP 发送一封测试邮件53%

编译自: https://fasterland.net/sendingemailviaphpcentos7usingsendmail.html 作者: Francesco Mondello译者: geekpi

同样,如果你正在运行一个 WordPress 博客,或者你正在使用任何类型的 CMS ,你允许你的访问者通过联系表单向你发送电子邮件(例如使用 WordPress 的 Contact Form 7[1] 插件),你可能需要安装一个名为 sendmail[2] 的简单的程序到你的 web 服务器上。

Sendmail 可以通过你的发行版的软件包管理器安装。

59397378cbbf9.jpg

安装

# yum install sendmail

如果在 CentOS 7 中使用了 SELinux, 你需要使用下面的命令允许 sendmail 发送邮件:

使用 PHP 发送一封测试邮件

php a

mail('user@receiver.com', "Test email", "Test email from the Internet", null, "f user@sender.com");

浏览 sendmail 日志

tail /var/log/maillog

via: https://fasterland.net/sendingemailviaphpcentos7usingsendmail.html

本文由 LCTT[5] 原创编译,Linux中国 荣誉推出

[1]: Contact Form 7 https://wordpress.org/plugins/contactform7/

[3]: 来自 Wikipedia https://en.wikipedia.org/wiki/Sendmail

[5]: LCTT https://github.com/LCTT/TranslateProject


本文由 帝一博客 原创发布。用户在本站发布的原创内容(包括但不仅限于回答、文章和评论),著作权均归用户本人所有。独家文章转载,请联系邮箱:17762131@qq.com。获得授权后,须注明本文地址: https://bubukou.com/phpjiqiao/105.html

网友留言评论

0条评论