Jun
19
一、需求: 将现成的eml格式的邮件在linux下批量发送。
二、步骤:
1. 复制eml格式文件到某个目录,如/root/waitsend
2. 将所有邮件进行处理,去除传输过程中添加的记录,只剩余原始的邮件正文,以下是实现这个功能脚本:
#!/bin/bash
cd $1
for filename in `ls`
do
sed /From:/ioooooooo $filename > $filename".bak"
sed -e /Received:/,/oooooooo/d $filename".bak" > $filename
rm -rf $filename".bak"
done
用法:./editmail.sh /root/waitsend
3. 将eml文件中内容逐个发送给用户,脚本如下:
#!/bin/bash
cd $2
for filename in `ls`
do
echo "sending mail from: "$filename"..."
sendmail $1 < $filename
done
用法:./sendmail.sh /root/waitsend
二、步骤:
1. 复制eml格式文件到某个目录,如/root/waitsend
2. 将所有邮件进行处理,去除传输过程中添加的记录,只剩余原始的邮件正文,以下是实现这个功能脚本:
#!/bin/bash
cd $1
for filename in `ls`
do
sed /From:/ioooooooo $filename > $filename".bak"
sed -e /Received:/,/oooooooo/d $filename".bak" > $filename
rm -rf $filename".bak"
done
用法:./editmail.sh /root/waitsend
3. 将eml文件中内容逐个发送给用户,脚本如下:
#!/bin/bash
cd $2
for filename in `ls`
do
echo "sending mail from: "$filename"..."
sendmail $1 < $filename
done
用法:./sendmail.sh /root/waitsend