有些时候我们需要在CentOS 服务器 上发送邮件,例如备份MySQL数据库并发送到指定邮箱,这里我们就说下如何从CentOS的shell命令发送邮件。
检查、安装、启动sendMail
//检查ps -ef | grep sendmail
//安装yum install sendmail
//启动service sendmail start
//开机启动chkconfig –level 2345 sendmail on
检查并安装mutt
//检查mutt是否安装, 已安装会返回/usr/bin/mutt# which mutt
//安装mutt# yum install mutt
配置mutt 1.配置全局mutt, 直接编辑 /etc/Muttrc 文件2.配置用户级mutt, 复制/etc/Muttrc 到 /当前用户/.muttrc
//为root用户复制.muttrc# cp /etc/Muttrc /root/.muttrc
配置mutt, 上述两种方法修改方式相同
#设置邮件编码方式Set charset=”utf-8″

#自定义发件人信息set envelope_from=yes #这条默认没有,请手动添加set use_from=yesset[emailprotected]set realname=”Master Lee”
测试发送邮件
//语法mutt [-hnpRvxz][-a<文件>][-b<地址>][-c<地址>][-f<邮件文 件>][-F<配置文件>][-H<邮件草稿>][-i<文件>][-m<类型>] [-s<主题>][邮件地址]发送mutt[emailprotected]-s “测试mutt” -a test.txt < test.txt
echo “邮件正文” | mutt[emailprotected]-s”xxxx” -a test.txt
如果邮件发送错误,查看日志(/var/log/mailLog)
别来晚了用英语的三种说法
you Cant return home too late . youd better return your home early / you shouldnt g back home to late .——————希望帮到你,满意请采纳。
“笨蛋 就算以后分开了 也不可以忘记” 用英语怎么说?
you are such a fool guy! we shouldnt forget each other even if weseperate in the future.这句话要对谁说呢~呵呵↖(^ω^)↗
zabbix邮件报警怎么设置无限制接收邮件
同问。 。 。
发表评论