手机
当前位置:查字典教程网 >操作系统 >RedHat/Centos >CentOS下邮件服务sendmail的安装及简单配置
CentOS下邮件服务sendmail的安装及简单配置
摘要:sendmail是Linux下优秀的邮件系统。在不做任何设定的情况下,sendmail发出邮件的邮箱源地址形如userid@localhos...

sendmail是Linux下优秀的邮件系统。在不做任何设定的情况下,sendmail发出邮件的邮箱源地址形如userid@localhost.localdo,这种地址几乎会被所有的邮箱认定为SPAM(垃圾邮件)或直接拒收。

1、 Sendmail安装

在CentOS下,sendmail一般默认是随操作系统一起安装的。如果安装系统时没有安装sendmail服务,手动安装sendmail也很简单:

# yum install -y sendmail

# yum install -y sendmail-cf

2、 Senmail的SMTP认证配置(不需要认证的可忽略此步)

首先确认saslauthd服务是否安装或启动。

安装saslauthd服务:

# yum install -y saslauthd

启动saslauthd服务:

# service saslauthd start

(1) 配置Senmail的SMTP认证

# vi /etc/mail/sendmail.mc

dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

将上面两行的dnl去掉。在sendmail文件中,dnl表示该行为注释行,是无效的,因此通过去除行首的dnl字符串可以开启相应的设置行。

(2) 设置Sendmail服务的网络访问权限

# vi /etc/mail/sendmail.mc

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

将127.0.0.1改为0.0.0.0,意思是任何主机都可以访问Sendmail服务。如果仅让某一个网段能够访问到Sendmail服务,将127.0.0.1改为形如192.168.1.0/24的一个特定网段地址。

3、 生成Sendmail配置文件

Sendmail的配置文件由m4来生成,m4工具在sendmail-cf包中。如果系统无法识别m4命令,说明sendmail-cf软件包没有安装。

生成Sendmail的配置文件:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

需要重启Sendmail才能使配置文件生效。

4、postfix与sendmail的冲突问题

在Linux服务器(CentOS release 6.6)上配置好了sendmail后,测试发送邮件时发现有问题,检查sendmail服务的状态,发现其处于“sendmail dead but subsys locked”, 检查发现postfix服务也在运行。只需要将postfix服务停掉即可。为什么会出现这种情况呢?Something was occasionally causing the postfix service to start which then caused the status of sendmail to jump to dead but subsys locked. 两种似乎不兼容。

操作步骤:

(1):检查sendmail服务的状态

[root@DB-Server ~]# service sendmail statussendmail dead but subsys lockedsm-client (pid 22112) is running...

(2):检查postfix服务的状态

[root@DB-Server ~]# service postfix statusmaster (pid 1777) is running...

(3):停止postfix服务

[root@DB-Server ~]# service postfix stopShutting down postfix: [ OK ]

(4):重新启动sendmail服务

[root@DB-Server ~]# service sendmail stopShutting down sm-client: [ OK ]Shutting down sendmail: [FAILED][root@DB-Server ~]# service sendmail stop[root@DB-Server ~]# service sendmail startStarting sendmail: [ OK ]Starting sm-client: [ OK ]

(5):禁用postfix在reboot后自动启动

检查一下是否有设定 postfix 在 reboot 后自动启动

chkconfig --list | grep postfix

chkconfig postfix off

【CentOS下邮件服务sendmail的安装及简单配置】相关文章:

在CentOS 6.3中安装与配置JDK-7

Linux系统下软件的安装与卸载

CentOS VPS服务器安装图形化界面教程

RedHat 9.0下Apache+PHP+MySQL服务器安装配置

CentOS中net-snmpd的安装和基本配置教程

在CentOS 6.3中安装与配置cmake

CentOS自动化安装实战

Linux下Shorewall防火墙安装和配置

在CentOS下安装和卸载图形化界面的方法

CentOS 6.5服务器安全加固及性能优化

精品推荐
分类导航