配置文件如下:
[[email protected] ~]# vim /etc/mail.rc
set [email protected] smtp=smtp.163.com
set [email protected] smtp-auth-password=密码
set smtp-auth=login
在所用邮箱开启smtp协议
测试
[[email protected] ~]# echo "hello" | mail -s "hello test" [email protected]
邮箱收到邮件
PS:
read -p 'Please input QQ' QQ
read -p 'Please input the mail-number' n
for i in `seq $n ` ; do echo ‘hello $i ’ | mail -s "hello $i" [email protected] &> /dev/null ; done
转载于:https://blog.51cto.com/zebra930/1869861