|
能过PMTA+OEMPRO方案发送邮件会在/var/log/pmta下按日期产生日志,记录发送的情况,投递成功通常会在日志中返回2.0.0 (success),而多数异常情况将会返回5.*.*的状态码,如5.0.0为This account has been disabled or discontinued和5.7.1 (delivery not authorized)等等,
通过如下代码可导出包含这些异常情况的邮箱
- cat /var/log/pmta/acct-2015-*.csv | grep '.*5\.[0-9]\.[0-9].*' >> /root/bounce.txt
- cat /root/bounce.txt | awk -F "," '{print $6}' >> /root/bounceemail.txt
复制代码 以上输出两个文件主要是方便读取bounce.txt进行进一步的验证,当然也可以选择直接使用如下语句直接输出邮箱:
- cat /var/log/pmta/acct-2015-*.csv | grep '.*5\.[0-9]\.[0-9].*' | awk -F "," '{print $6}' >> /root/bounceemail.txt
复制代码 而如果想要取出已经不存在的邮箱,可以只提取5.0.*和5.1.*的部分,仅需使用
- cat /var/log/pmta/acct-2015-*.csv | grep '.*5\.[0-1]\.[0-9].*' | awk -F "," '{print $6}' >> /root/hardbounceemail.txt
复制代码 cat /var/log/pmta/acct* |grep success | awk -F "," ' {print $6}' > /root/success-email.txt
从日志中筛选发送成功(标记为“success”)的地址进行保存,保存结果为/root/success-email.txt
|
|