邮件服务器上对所有的用户群发邮件,步骤如下:
1、导出邮件账号
echo 'use postfix;select address from userinfo;'|mysql -u root -pxxxx>mail.txt
2、将要群发的邮件复制成文本文件mail.body
3、编写mail.sh脚本
vi mail.sh
内容如下:
#!/bin/sh
hangshu=`wc -l mail.txt |awk '{print $1}'`
echo $hangshu;
cishu=0
while [ $cishu -lt $hangshu ]
do
mailuser=`head -1 mail.txt`
mail -s 'notifyi' $mailuser< mail.body
sed '1,1d' mail.txt >mail.tmp
rm -rf mail.txt
mv mail.tmp mail.txt
cishu=$(($cishu+1))
echo $mailuser
echo $cishu
done;
阅读(1634) | 评论(0) | 转发(1) |