#mailx是一个邮件发送程序,像 sendmail postfixyum install mailx#编辑mail配置文件vi /etc/mail.rc set from=123456@sina.com smtp=smtp.sina.comset smtp-auth-user=123456@sina.com smtp-auth-password=b78e6f39cc4699adset smtp-auth=login#发送邮件 #例子#mail -s "标题" 邮件地址 < 要发送的文件#mail -s "hello world" 623799533@qq.com </etc/hosts#echo "正文"|mail -s "hello world" 623799533@qq.comecho "this is liuzhe." |mail -s "monitor" 123456@sina.com #!/bin/bash#mailx是一个邮件发送程序yum install mailx#添加邮件账户,密码cat >> /etc/mail.rc << EOFset from=123456@sina.com smtp=smtp.sina.comset smtp-auth-user=123456@sina.com smtp-auth-password=d2aa4bb9a942a7d2set smtp-auth=loginEOF#发送邮件"this is xiaozhezhe."到123456@sina.comecho "this is xiaozhezhe." |mail -s "hello" 123456@sina.com