[root@node03 ~]# wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
[root@node03 ~]# clear
[root@node03 ~]# mkdir -p /usr/local/bin
[root@node03 ~]# tar zxf sendEmail-v1.56.tar.gz -C /usr/src/
[root@node03 ~]# cd /usr/src/sendEmail-v1.56/
[root@node03 sendEmail-v1.56]# cp -a sendEmail /usr/local/bin/
[root@node03 sendEmail-v1.56]# chmod +x /usr/local/bin/sendEmail
[root@node03 sendEmail-v1.56]# yum install perl-Net-SSLeay perl-IO-Socket-SSL -y
[root@node03 sendEmail-v1.56]# clear
[root@node03 sendEmail-v1.56]# cd
[root@node03 ~]# mkdir email
[root@node03 ~]# cd email/
[root@node03 email]# vi sEmail
#!/bin/bash
#收件箱
EMAIL_RECIVER="508529886@qq.com"
#发送者邮箱
EMAIL_SENDER=508529886@qq.com
#邮箱用户名
EMAIL_USERNAME=508529886
#邮箱密码
#使用qq邮箱进行发送需要注意:首先需要开启:POP3/SMTP服务,其次发送邮件的密码需要使用在开启POP3/SMTP服务时候腾讯提供的第三方客户端登陆码。
EMAIL_PASSWORD=htsihblikjodcafb
#附件路径
FILE1_PATH="/root/anaconda-ks.cfg"
#smtp服务器地址
EMAIL_SMTPHOST=smtp.qq.com
EMAIL_TITLE="测试"
EMAIL_CONTENT="Hello Spark"
sendEmail -f ${EMAIL_SENDER} -t ${EMAIL_RECIVER} -s ${EMAIL_SMTPHOST} -u ${EMAIL_TITLE} -xu ${EMAIL_USERNAME} -xp ${EMAIL_PASSWORD} -m ${EMAIL_CONTENT} -a ${FILE1_PATH} -o message
-charset=utf-8
[root@node03 email]# chmod + sEmail
[root@node03 email]# ll
total 4
-rw-r--r-- 1 root root 732 Apr 13 11:04 sEmail
[root@node03 email]# chmod +x sEmail
[root@node03 email]# ./sEmail
Apr 13 11:04:52 node03 sendEmail[1287]: Email was sent successfully!
注意:使用qq邮箱进行发送需要注意:首先需要开启:POP3/SMTP服务,其次发送邮件的密码需要使用在开启POP3/SMTP服务时候腾讯提供的第三方客户端登陆码。