1.安装mailx
yum -y install mailx
2.邮件配置
vi /etc/mail.rc 新增 set bsdcompat set from=邮寄地址 set smtp=smtp地址 set smtp-auth-user=用户名 set smtp-auth-password=密码 set smtp-auth=login
3.发送邮件
mail_subject="" mial_addr="收件箱" mail_copy="抄送" mail_content="邮件正文" mail_a="文件全路径" echo -e $mail_content | mail -s $mail_subject -c $mail_copy -a$mail_a $mail_addr