Ret Hat 下SendMail

 Ret Hat 下SendMail

工具:RHEL7.5、Win7
SendMail服务器:RHEL7.5

----------------------------------------------------------------------------------------------------------------------------

*****************************************************************************************************************************


1.安装sendmail组件
    检查是否安装sendmail组件
    rpm -qa | grep sendmail

    查看是否有sendmail系列包
    yum grouplist sendmail
    
    查看sendmail相关的包
    yum list | grep sendmail

2.安装sendmail组件
    yum install sendmail -y

3.编辑/etc/aliases文件
    vi /etc/aliases

        # trap decode to catch security attacks
        decode:         root
        
        # Person who should get root's mail
        #root:          marc
        如果我配置别名为root的,配置接收邮件(下面邮件仅仅是一个模板而已)

  

4.修改配置文件sendmail.cf
    vim /etc/mail/sendmail.cf
        # host/domain names ending with a token in class P are canonical
        CP.
    
        # "Smart" relay host (may be null)
        DS[xxx.xxx.xxx.xxx]
    
        # operators that cannot be in local usernames (i.e., network indicators)
        CO @ % !
    
        # a class with just dot (for identifying canonical names)

5.重启sendmail服务
    service sendmail restart

6.测试邮件服务
    如下所示,使用mail命令测试能否成功收到邮件。如果成功,表示前面配置OK, 如果没有收到邮件,则必须检查日志,然后根据具体错误信息诊断问题。
        [root@mylnx06 ~]# cat > test.txt
        it is only test
        ^Z
        [1]+  Stopped                 cat > test.txt
        [root@mylnx06 ~]# mail -s "test" [email protected] < test.txt
        [root@mylnx06 ~]#
        [azrlnx06azlnx06 ~]$ echo 'it is only a test' | mail -s "test eamil"  [email protected]
        [azrlnx06@azlnx06 ~]$    

猜你喜欢

转载自www.cnblogs.com/handsky/p/linux_server_00011.html
今日推荐