CentOS下邮件服务sendmail的安装及简单配置

2023-12-04 0 994

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

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 RedHat/Centos CentOS下邮件服务sendmail的安装及简单配置 https://www.u-9.cn/system/redhatcentos/78451.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务