1. 编辑/etc/mail.rc,添加如下
set from=xxx@163.com smtp=smtp.163.com
set smtp-auth-user=xxx@163.com smtp-auth-password=XXXXXX smtp-auth=login
2. 使用mail命令发送测试邮件mail -s "test" xxx@163.com < /home/md/cmdfile
如上所述只适用于RHEL/CentOS 6.X以上版本,如要在RHEL 4/5上不配置sendmail直接用mail发送邮件,可安装nail RPM包
http://rpm.pbone.net/index.php3/stat/4/idpl/16350845/dir/redhat_el_4/com/nail-12.3-4.el4.rf.x86_64.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/12055091/dir/redhat_el_5/com/nail-12.3-4.el5.rf.i386.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/12088603/dir/redhat_el_5/com/nail-12.3-4.el5.rf.x86_64.rpm.html