配置文件如下:
[root@localhost ~]# vim /etc/mail.rc
set [email protected] smtp=smtp.163.com
set [email protected] smtp-auth-password=密碼
set smtp-auth=login
在所用郵箱開啓smtp協議
測試
[root@localhost ~]# 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