centos 5.5 + php5.3.3环境中配置sendmail
思韵闪耀
2013-03-18
0

CentOS 5.5下安装完成后主要是遇到了下面错误,记录下来供大家参考:
sh: -t: command not found

我的系统是通过网络最小化安装的,所以有很多命令和小工具以及一些服务都没有安装。

今天抽空安装了一下Sendmail:
1. 查找需要安装包:

[root@www.linuxidc.com ~]# yum search sendmail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: centos.mirror.cdnetworks.com
 * base: centos.mirror.cdnetworks.com
 * extras: centos.mirror.cdnetworks.com
 * updates: centos.mirror.cdnetworks.com
======================================================== Matched: sendmail =========================================================
exim.x86_64 : The exim mail transfer agent
php-pear-Mail.noarch : Class that provides multiple interfaces for sending emails
sendmail.x86_64 : A widely used Mail Transport Agent (MTA).
sendmail-cf.x86_64 : The files needed to reconfigure Sendmail.
sendmail-devel.i386 : Extra development include files and development files.
sendmail-devel.x86_64 : Extra development include files and development files.
sendmail-doc.x86_64 : Documentation about the Sendmail Mail Transport Agent program.
spamassassin.x86_64 : Spam filter for email which can be invoked from mail delivery agents.
sysklogd.x86_64 : System logging and kernel message trapping daemons.

2. 我选择性进行了安装:

[root@www.linuxidc.com ~]# yum install sendmail sendmail-devel sendmail-cf sendmail-doc mailx
#mailx 方便命令行发邮件

3. 安装完成,下面开始测试
3.1 命令行测试:

[root@www.linuxidc.com ~]

检查邮件,发送成功。
如果没有收到可以查看/var/log/maillog中数据内容。
3.2 写PHP进行测试
将下面代码保存为mailtest.php:

$message = 'test mail for www.linuxidc.com';
mail('web@www.linuxidc.com', 'My Subject', $message);

然后执行进行测试:

[root@www.linuxidc.com ~]# php mailtest.php
#提示错误:
sh: -t: command not found

解决办法配置php.ini, 主要原因是sendmail_path找不到sendmail:

[root@www.linuxidc.com ~]# vi /usr/local/php/lib/php.ini
[mail function]

SMTP            = localhost
smtp_port      = 25
sendmail_path = '/usr/sbin/sendmail.sendmail -t -i'
mail.add_x_header = On
mail.log                =/tmp/mail.log 
 

【版权声明】
本站部分内容来源于互联网,本站不拥有所有权,不承担相关法律责任。如果发现本站有侵权的内容,欢迎发送邮件至masing@13sy.com 举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

相关内容

Linux系统挂载未分配硬...
先查看未挂载之前的磁盘使用情况发现磁盘使用率已经达到了96%,迫切...
2025-02-22
Linux lsblk 命...
简介Linux 中的 lsblk 命令,全称叫做:list blo...
2025-02-22
linux内核5和6区别
Linux内核5.x和6.x版本之间有显著的区别,这些区别主要体现...
2024-04-29
docker-compos...
1.Compose介绍 DockerCompose是一个用来定义和...
2024-04-26
centos stream...
1、更新系统软件包确保系统已经更新到最新版本,打开终端,执行以下命...
2024-03-30
Linux中的防火墙(Ne...
NetfilterNetfilter是Linux 2.4内核引入的...
2024-03-15

热门资讯

Discus X论坛配置sen... Discuz x2.5 后台邮件设置方法其实和X2/x1.5基本一样,但很多同学都不注意一些细节,比...
redhat Linux系统配... 1 .检查Send Mail 的安装包 [root@sql root]# rpm -qa | gre...
使用Sendmail的反垃圾邮... 在最近几年,无处不在的垃圾邮件已使得所有邮件箱不堪重负,不断地需要工具以抗击这一无穷尽的垃圾邮件流。...